Custom post type pagination – always return first page

I have custom post template archive-product.php for custom post type “product”.

In this template paging does not work:

Read More
  • numbers are displayed
  • all numbers links redirect to first page

        <?php if (($numParent) == 4) {?>
    
        do stuff
    
        <?php } elseif (($numParent) == 3) { 
    
            $paged = 1;  
            if ( get_query_var('paged') ) $paged = get_query_var('paged');  
            if ( get_query_var('page') ) $paged = get_query_var('page'); 
            query_posts = array('post_parent'=> $post->ID, 'post_type'=>'product','paged' => $paged, 'posts_per_page' => 10); 
            while ( have_posts() ) : the_post();?>
    
                do stuff
    
            <?php endwhile; ?>
            <?php if ( function_exists( 'wp_pagenavi' ) ) {
                wp_pagenavi();
            }; 
        } endif;?>
    

How to fix paging?

Related posts

Leave a Reply