Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Gallery Attachment Pagination X images per page WordPress

  • SOLVED

Background

I am looking for a simple way to create what I call pagination for a image attachment gallery. My goal is split X images to appear on X pages so that when someone visits a post with 100 pictures, all 100 aren't loading all at once. Instead I would like the visitor to view, say 10 images and then be able to go to another page for the next 10, so on.

I'm using the following to gather attachments
<?php echo do_shortcode('[gallery id="'.$post->post_parent.'" size="thumbnail" columns="5"]'); ?>

This code is located in my image.php file which shows a 5 columns (pictures), per row.

Answers (3)

2018-02-21

Cesar Contreras answers:

You could try using "Lazy load", adding it to your code or as a plugin

2018-02-21

Bob answers:

Please checkout answer given here.

https://wordpress.stackexchange.com/questions/89462/how-to-paginate-wordpress-gallery-shortcode


Bob comments:

Please checkout this link also.

https://www.irishwebhq.com/wordpress-gallery-pagination-free-plugin/


TWDesigns comments:

I tried the first one and it almost worked earlier. If I click a thumbnail image it goes to the wrong page and doesn't load the image.

As for the 2nd comment I try to avoid plugins.

Thanks!


Bob comments:

can we see your code related to my first comment which you tried and taking user to wrong page.

fixing that one thing will be easy instead of writing whole new code.


TWDesigns comments:

I would have to re-add it. I removed it in search of a simpler solution, which there may not be one. I would have thought that telling the gallery to only load X images before splitting the page would have been simpler :(

I do recall that the issue seemed to be the call in the code you mentioned listed /gallery/image I think. Upon click it would reroute to a listing (post) I have for a night club called Image. Plus my attachments are pulled from www.sitename.ext/categoryname/listingname/attachment/imagename.jpg

I am not a programmer when it comes to PHP which doesn't help.

2018-02-21

Arnav Joy answers:

can you please show me your site ?


TWDesigns comments:

Sent