WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
all custom post type pagination (4 posts)

  1. karjogedhe
    Member
    Posted 1 year ago #

    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/

  2. ngorco
    Member
    Posted 1 year ago #

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

  3. Hiranthi
    Member
    Posted 1 year ago #

    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.

  4. karjogedhe
    Member
    Posted 1 year ago #

    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.. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic