Support » How-To and Troubleshooting » Limited number of posts on blog

Limited number of posts on blog

  • Hello,

    In my custom theme im developing I want there to be about 10 posts on the blog page. I’ve noticed that in the admin you can set the desired amount of posts to show. I’m hoping someone knows of a write up that explains how to make the extra posts (after exceeding your set amount in the admin) fall onto a second, third, fourth, ect.. page. I also need to make the secondary pages be able to be navigated to with a numbered list at the bottom of the blog page.

    I know this is very basic but I haven’t had much luck finding write ups on this.

    Thanks so much everyone!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer


    If your theme doesn’t provide navigation you need to add a pagination function to your theme template files.

    numbered pagination function:

    More pagination functions: http://codex.wordpress.org/Pagination#Function_Reference

    Or use a plugin for the numbered pagination:

    What theme are you using?

    I’m currently coding one from scratch. I used the twenty ten as a base though.

    Moderator keesiemeijer


    Twenty ten has pagination before and after the loop in the loop.php template file:

    <?php /* Display navigation to next/previous pages when applicable */ ?>
    <?php if ( $wp_query->max_num_pages > 1 ) : ?>
    	<div id="nav-below" class="navigation">
    		<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
    	</div><!-- #nav-below -->
    <?php endif; ?>

    Maybe replace that code with this [untested]:

    <?php /* Display navigation to page numbers when applicable */ ?>
    <?php if ( $wp_query->max_num_pages > 1 ) : ?>
    	<div id="nav-below" class="navigation">
    global $wp_query;
    $big = 999999999; // need an unlikely integer
    echo paginate_links( array(
    	'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    	'format' => '?paged=%#%',
    	'current' => max( 1, get_query_var('paged') ),
    	'total' => $wp_query->max_num_pages
    ) );
    	</div><!-- #nav-below -->
    <?php endif; ?>

    Do you have more posts than set in the wp-admin, so pagination would show up?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Limited number of posts on blog’ is closed to new replies.
Skip to toolbar