WordPress.org

Support

Support » How-To and Troubleshooting » Query (by category name) next/previous posts links

Query (by category name) next/previous posts links

  • hey,

    i made a template page, that should only display posts in the category “blog”.

    i used <php query_posts('category_name=blog'); ?> which worked quite well.

    but now it does not work anymore beacuse page 2, 3, … all display the same first 10 posts.

    i tried to fix it with this help: http://wordpress.org/support/topic/querying-all-posts?replies=12#post-679318

    now my code looks like this:

    <?php
    $limit = get_option('posts_per_page');
    $page = (get_query_var('page')) ? get_query_var('page') : 1;
    query_posts('category_name=blog' . '&showposts=' . $limit . '&paged=' . $page);
    $wp_query->is_archive = true; $wp_query->is_home = false;
    ?>

    and after the posts

    <?php
    		endwhile;
    		next_posts_link('Previous Posts');
    		previous_posts_link('Next Posts');
    		?>

    on the first page the link “previous posts” appears and page 2 works fine. but at the bottom of page 2 there is only another link “previous posts” and not “next posts” and the “previous posts” link on page 2 does not work. it does not link me to page 3…

    can somebody please help me?

    would be great.

    thanks

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Query (by category name) next/previous posts links’ is closed to new replies.