Forums

[resolved] How to display ALL images in gallery with image.php (5 posts)

  1. ryanhellyer
    Member
    Posted 1 week ago #

    Hi,
    In the default theme, if you click on an image in a gallery, it takes you to a page generated via image.php. Do any of you know how to display the original gallery in this page?

    thanks :)

  2. greenshady
    Member
    Posted 1 week ago #

    This should work:

    <?php
    $post_parent = get_post($post->ID, ARRAY_A);
    $parent = $post_parent['post_parent'];
    
    $attachments = get_children("post_parent=$parent&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC");
    foreach($attachments as $id => $attachment) :
    	echo wp_get_attachment_link($id, 'thumbnail', true);
    endforeach;
    ?>
  3. ryanhellyer
    Member
    Posted 1 week ago #

    Thanks greenshady :)

  4. riri23
    Member
    Posted 1 week ago #

    Nice code, do you know how we can define the number of thumbnail per page or how to build a pagination with this code because I have more than 1000 images to display in this main gallery!

    Thanks for your help

    henri

  5. riri23
    Member
    Posted 5 days ago #

    Anybody know how I spilt the gallery generated by this code (how to make a pagination?)
    Thanks
    henri

Reply

You must log in to post.

About this Topic