Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have uploaded images before in my other posts and now I want to display it in my Photo Gallery. I'm using an isotope layout so I'm not using the native gallery of WordPress. It's working just fine however I can't display the images that is not uploaded directly to that post. For example the images that I've uploaded before. If I upload a new one to this current post, then that will display.

Here's my code:

        // DISPLAY ALL IMAGES FROM A PARENT GALLERY
        $attachments = get_children(array('post_parent' => $post->ID,
          'post_status' => 'inherit',
          'post_type' => 'attachment',
          'post_mime_type' => 'image',
          'order' => 'ASC',
          'orderby' => 'menu_order ID'));
        foreach($attachments as $att_id => $attachment) {

So how can I display those past images in my gallery?

share|improve this question
    
Please clarify what images you want to retrieve. What do you mean by "images that I've uploaded before" and "past images in my gallery"? –  s_ha_dum Jul 11 '13 at 14:34

1 Answer 1

Changing 'post_parent' => $post->ID to 'post_parent' => null will fetch all images.

share|improve this answer
    
It is not clear the OP wants "all images". There seems to be a condition for images in a "parent gallery" or "past images in my gallery". –  s_ha_dum Jul 11 '13 at 14:22
    
I see...I have uploaded images before in my other posts could mean, that he want's to get images which have been attached to any post in the past only without images, which are not attached to a post. I edit my answer as soon as we get more information. –  rfrq Jul 11 '13 at 14:32
    
I don't think you are wrong, necessarily, but the question isn't clear. –  s_ha_dum Jul 11 '13 at 14:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.