I was wondering what the best method for “Pagination” would be on gallery items?
Is this possible?
Hi,
if you want single-page pagination, you could use a jQuery plugin, for instance http://flaviusmatis.github.io/simplePagination.js/ . You can feed it your entire gallery and it will do the heavy lifting for you.
If you want multi-page pagination (where each page shows part of your gallery), you can use any simple php approach for pagination – and just query the part of the gallery you need on each page.
Unless you’re experienced with PHP, I suggest you take the first approach.
I’d rather stick to something more native to WordPress, so the second route would be better…but I’m not sure what you mean by:
just query the part of the gallery you need on each page.
I do work with PHP, but I’m not sure how to get pagination to work on images.
Well, create a page with a url like this
site.com/articles/article_with_gallery/page1
You assign the ACF gallery to “article_with_gallery” and you grab the last part of the URL (“page1”), substring the “page” away and you get the current position for the gallery (=show first image on this page).
Then you just display the first image from the gallery (it’s a simple array). For the next page, the next gallery image.
The navigation (previous/next gallery image) simply takes you to the next/previous page in the URL.
That’s an interesting concept…I will try it out and see how it works.
Hi just wondering how I would go about implementing the http://flaviusmatis.github.io/simplePagination.js/ method for a single page pagination function on an ACF gallery?
I tried to implement from the instructions on their website but I’m not sure how to feed the gallery through to get pagination.