page navigation issue (2 posts)

  1. luthan
    Posted 5 years ago #

    I am using twenty ten theme and am customizing it to make templates for my categories

    This is what I am using to get the posts:

    <?php query_posts("category_name=some_category&paged=$paged"); ?>

    and this is what i'm using to to add next/previous links.

    <div id="nav-above" 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>

    The pagination links do not show up on the first page, however if I manually go to the next page by appending page/2/ to the url, I see the pagination links on the second page.

    what am I missing?

  2. vtxyzzy
    Posted 5 years ago #

    Did you set the $paged variable before calling query_posts?

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;?>
    <?php query_posts("category_name=some_category&paged=$paged"); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic