WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: WP-PageNavi] navi for posts of a certain category (3 posts)

  1. swimy
    Member
    Posted 5 years ago #

    hi there
    is there the possiblity to use PageNavi to paginate thru all posts of a particular category?
    ie. if current post is in category A, then create pagination for all other posts that are also in category A
    thanks!

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. swimy
    Member
    Posted 5 years ago #

    anybody? i also tried using WP next_link from the codex, but doesnt have the support for category filter.
    http://codex.wordpress.org/Next_and_Previous_Links
    thanks!

  3. ezytiger
    Member
    Posted 4 years ago #

    I had this same issue. I found the answer here - http://stylizedweb.com/2008/08/13/query_posts-pagination-problem/.

    The code to fix is:

    <?php if (have_posts()) : ?>
        <?php query_posts("category_name=somecat"); ?>
            <?php while (have_posts()) : the_post(); ?>  
    
    replace with 
    
    <?php if (have_posts()) : ?>
         <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("category_name=somecat&paged=$paged"); ?>
            <?php while (have_posts()) : the_post(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic