Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Get array of Images from a WordPress Post

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #36878
    noahgelman
    Participant

    In the wordpress loop, I’m trying to get an array of images that are used in a blog post but Google has only been showing me old answers that aren’t compatible anymore

    #97600
    Kermet
    Member

    http://codex.wordpress.org/Function_Reference/wp_get_attachment_image

    The first example should be what you’re looking for.

    #97607
    noahgelman
    Participant

    @Kermet, thanks for the link. That helped me solved what the real issue was. It’s not counting the images in the post as attachments. When you insert an image into a post, it adds it to that posts’ media gallery. The post I was testing this on was only showing one image in it’s media gallery even after I attached more images. Other posts with more images in their media gallery are showing more images.

    Do you know why this is?

    #97609
    noahgelman
    Participant

    Yeah, with a bit more testing. Only images uploaded to that specific post are showing up as attachments. Images uploaded to other posts arent counted.

    What I’m looking for is an array of images that are actually inserted into the post, and not necessarily uploaded to that specific post.

    #97619
    Kermet
    Member

    I use attachments plugin (http://wordpress.org/extend/plugins/attachments/) to attach media to a post, then i can retrieve all the attached media as an array.
    You could try that if wordpress’ get_attachment function doesn’t do the trick for you

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.