SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast MartyBoi's Avatar
    Join Date
    Dec 2011
    Saginaw MI
    0 Post(s)
    0 Thread(s)

    Question ' WP-Paginate ' and Custom Templates .... Help!

    I had created a Custom Gallery Template, I want to only have 20 images per page. So what I wanted to do, is use the WP-Paginate.

    So my question is, can I use it within a Custom Template, and if so, how?

    I am open to other suggestions if I can get the same result.

    Here is the code to my Custom Template:

    	Template Name: Gallery Template
    <?php get_header(); ?>
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<article class="post" id="post-<?php the_ID(); ?>">
    			<h2><?php the_title(); ?></h2>
            <?php endwhile; endif; ?>
    <?php get_footer(); ?>

  2. #2
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    45 Post(s)
    0 Thread(s)
    Does the template use a plug-in for the gallery itself? Because if it's something like NextGEN Gallery, you can paginate it right from the settings menu. That would be the best way.

    Other than that, have a look at this page in the Codex;

    For most websites, pagination is as easy as using the template tags;
    <?php previous_post(); ?>
    <?php next_post(); ?>
    Maybe give them a try in your code and see if it works.

    That wouldn't break off your images after twenty, but allow you to paginate between previous and next posts. If you publish twenty images in each post, you could bodge together something like what you have in mind.
    Trying to fill the unforgiving minute
    with sixty seconds' worth of distance run.

    Update on Sitepoint's Migration to Discourse


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts