我有页面属性。php在循环文件夹中使用此代码。我只看到了8篇帖子(自定义帖子类型),但我想看到所有的帖子都有分页,怎么了?
<?php
$view = \'archive\';
if ( is_singular() )
$view = \'single\';
elseif ( is_search() )
$view = \'search\';
elseif ( is_404() )
$view = \'404\';
if ( Pojo_Compatibility::is_bbpress_installed() && is_bbpress() )
$view = \'page\';
do_action( \'pojo_setup_body_classes\', $view, get_post_type(), \'\' );
get_header();
do_action( \'pojo_get_start_layout\', $view, get_post_type(), \'\' );
?>
<header>
<?php if ( po_breadcrumbs_need_to_show() ) : ?>
<?php pojo_breadcrumbs(); ?>
<?php endif; ?>
<?php if ( pojo_is_show_page_title() ) : ?>
<div class="page-title">
<h1><?php the_title(); ?></h1>
</div>
<?php endif; ?>
</header>
<?php the_content(); ?>
<?php
global $_pojo_parent_id, $custom_query;
$_pojo_parent_id = get_the_ID();
$pagination = atmb_get_field( \'po_pagination\' );
$display_type = po_get_display_type();
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$args = array ( \'post_type\' => \'property\', \'post_per_page\' => 8, \'paged\' => $paged );
$custom_query = new WP_Query( $args );
?>
<?php if ( $custom_query->have_posts() ) : ?>
<?php do_action( \'pojo_before_content_loop\', $display_type ); ?>
<?php while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
<?php pojo_get_content_template_part( \'content\', $display_type ); ?>
<?php endwhile;
?>
<?php do_action( \'pojo_after_content_loop\', $display_type ); ?>
<?php if ( \'hide\' !== $pagination ) : ?>
<?php pojo_paginate( ); ?>
<?php endif; ?>
<?php echo apply_filters( \'the_content\', \'\' ); ?>
<?php endif; ?>
<?php endif; ?>
<?php pojo_button_post_edit(); ?>
最合适的回答,由SO网友:Waldo Rabie 整理而成
如果您转到URLhttps://nadlancz.com/page/2/ 您将看到导航工作正常。
要查看导航链接,您需要做的是在页面中添加类似的内容
<!-- Navigation -->
<?php
$pagination = get_the_posts_pagination(array(
\'mid_size\' => 2,
\'prev_text\' => \'Previous\',
\'next_text\' => \'Next\',
));
if (defined(\'DOING_AJAX\')) {
$pagination = reformat_ajax_pagination($pagination);
}
echo $pagination;
?>