我已经创建了一个家。php文件,其中我显示了我的自定义帖子类型“带有WP查询的项目”。我已经使用“paginate\\u links()”将分页添加到我的自定义帖子类型中,并显示了列表,但当您单击它们时,会显示“找不到错误”。下面是我正在使用的循环代码:
$args = array(
\'post_type\' => \'projects\',
\'posts_per_page\' => 3,
\'paged\'=> $paged,
\'order_by\' => \'date\',
);
$projects = new WP_Query( $args );
while( $projects -> have_posts() ): $projects -> the_post();
///////// the content of the post types
endwhile;
这是我用于分页链接的代码: $big = 999999999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ))),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $projects->max_num_pages
) );