WordPress.org

Support

Support » Requests and Feedback » use two wp_pagenavi in one page

use two wp_pagenavi in one page

  • sfarid
    Member

    @sfarid

    I want to show posts with cat=3, let say newsA
    and below posts with cat=6, let say newsB
    For each newsA and newsB I use wp_pagenavi();
    The problem is, if I click, for example page 3 of newsA, the newsB also changes.
    Is it possible to use wp_pagenavi() two times in one page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Lester Chan
    Participant

    @gamerz

    If I am not wrong, it is not possible.

    sfarid
    Member

    @sfarid

    I solved this problem.
    for the newsA a set
    if(function_exists(‘wp_pagenavi’)) {
    wp_pagenavi(0);
    }

    and for the newsB a set
    if(function_exists(‘wp_pagenavi’)) {
    wp_pagenavi(1);
    }

    in wp_pagenavi i send this variable $number back
    function wp_pagenavi($number){

    echo ‘a href=”‘.get_pagenum_link($i).’&pagenavi=’.$number.'” title=”‘.$page_text.'”‘.$page_text.’/a’;

    }

    now I cann handle this variable in my template like this:
    $myPageNaviLink = “&paged=”.$wp->query_vars[‘paged’];
    $wpQuery=”cat=3&showposts=5″;
    if ($_GET[‘pagenavi’]==0) {
    $wpQuery = $wpQuery.$myPageNaviLink;
    }
    query_posts($wpQuery);

    if(function_exists(‘wp_pagenavi’)) {
    wp_pagenavi(0);
    }

    $wpQuery=”cat=6&showposts=5″;
    if ($_GET[‘pagenavi’]==1) {
    $wpQuery = $wpQuery.$myPageNaviLink;
    }
    query_posts($wpQuery);

    if(function_exists(‘wp_pagenavi’)) {
    wp_pagenavi(1);
    }

    Coffee4cr
    Member

    @coffee4cr

    Hey sfarid,
    I’m trying to use your trick, because it’s exactly what i need on my site.
    But i’m still unable to use it properly.
    I’m using the most recent pagenavi plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘use two wp_pagenavi in one page’ is closed to new replies.