Home Forums Add-ons Gallery Field Gallery pagination


Gallery pagination

  • I have a custom post type called ‘artist’. I am currently using a customized template file called ‘single-artist.php. In this file I am using an ACF gallery along with Simple Lightbox. Works great! The only thing is that my list of thumbnails is going to run quite long down the page so it would be great if I could use a pagination under say 10 thumbnails and the user can just click through the pagination to see more. I am currently using the following code to display my thumbnails. How do I add a pagination to this?

        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <div id="galleryLeft">
    	<div id="galleryThumbs"><?php $images = get_field('gallery');
    if( $images ): ?>
    <div class="gallery">
            <?php foreach( $images as $image ): 
                $content = '<li>';
                    $content .= '<a class="gallery_image" href="'. $image['url'] .'">';
                         $content .= '<img src="'. $image['sizes']['thumbnail'] .'" alt="'. $image['alt'] .'" />';
                    $content .= '</a>';
    				$content .= $image['title'];
    				$content .= '';
    				$content .= '<span class="sold">';
    				$content .= $image['caption'];
    				$content .= '</span>';
                $content .= '</li>';
                if ( function_exists('slb_activate') ){
        $content = slb_activate($content); $size   = 'large';
    echo $content;
            <?php endforeach; ?>
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.