WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WP-PageNavi] all custom post type pagination

[Plugin: WP-PageNavi] all custom post type pagination

  • karjogedhe
    Member

    @karjogedhe

    I have the code above, which mean to create pagination use WP_PAGENAVI for all custom post types

    $values = Array
    (
    [0] => custom-post-type-1
    [1] => custom-post-type-2
    [2] => custom-post-type-3
    [3] => custom-post-type-4
    )

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array(
    	'post_type' => $values,
    	'paged' => $paged,
    	'post_status' => 'publish',
    	"$tax" => $tax_term->slug,
    	'posts_per_page' => 2,
    	'caller_get_posts'=> 1
    	);
    $my_query = null;
    $my_query = new WP_Query($args);
       if( $my_query->have_posts() ) {
    	while ($my_query->have_posts()) : $my_query->the_post();
                 //some custom code for display post type
            endwhile;
         }
       wp_reset_query();
       wp_pagenavi( array( 'query' => $my_query ) );

    all display is correct, but when I want to go to second page, the post of custom post types didn’t change to the older post. Is there something missing from my codes?

    need for solutions for this 🙂

    best regards

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • ngorco
    Member

    @ngorco

    I think you reseted your query too early. It clearing your custom posts query, so you cannot see any changes.

    Hiranthi
    Member

    @illutic

    The reset of the query indeed is too early. Besides that you aren’t including the pagenumber in the custom query, which means WP just re-loads the posts from page 1.

    karjogedhe
    Member

    @karjogedhe

    Sorry for late replay, thanks for your considered
    I think the problem is on the custom post type and page SLUG name, it can’t using same name of slug. it work on the other pages, but not in the main page (home).. still figure it out for it..

    thanks anyway.. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP-PageNavi] all custom post type pagination’ is closed to new replies.