我在页面上使用以下 php 代码来显示来自单个类别的每页 10 个帖子。
function my_page_of_posts5() {
if (is_page('10')) {
$custom_loop = new WP_Query('posts_per_page=10&cat=9');
echo '<div class="my-archives"><ul class="archive-list">';
if ( $custom_loop->have_posts() ) :
while ( $custom_loop->have_posts() ) : $custom_loop->the_post();
echo '<li><a class="archive-link" href="'
. get_permalink() . '">'
. get_the_title()
. '</a> <span class="my-comment-count">( ';
comments_number('0', '1', '%');
echo ' )</span></li>';
the_excerpt();
endwhile;
wp_reset_query();
endif;
echo '</ul></div>';
}
}
add_action('thesis_hook_after_content','my_page_of_posts5');
我正在使用论文 WordPress 主题框架。
我想在页面上的这些帖子之后显示分页。
我应该放什么代码来显示分页?
我试过使用 WP-Paginate 插件并将 wp-paginate(); 页面上的功能,但它不能正常工作。
需要另一种方法来解决它。