How to include pagination in a Wordpress Custom Post Type Query

后端 未结 2 872
太阳男子
太阳男子 2020-12-01 05:40

I have the code below:



 have_posts())          


        
2条回答
  •  旧时难觅i
    2020-12-01 06:30

    Try the code below:

        $the_query = new WP_Query( array('posts_per_page'=>30,
                                     'post_type'=>'phcl',
                                     'paged' => get_query_var('paged') ? get_query_var('paged') : 1) 
                                ); 
                                ?>
     have_posts()) : $the_query -> the_post(); ?>
    
     str_replace( $big, '%#%', get_pagenum_link( $big ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $the_query->max_num_pages
    ) );
    
    wp_reset_postdata();
    

提交回复
热议问题