我想显示所有自定义帖子类型中的一个类别的帖子,我的代码做得很好,但分页刚刚停止。这是我的代码:
<div class="col-md-9 exerpts-wrap">
<div class="row">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts(array(
'post_type' => array('post', 'resources', 'products'),
'category__in' => array(3)
));
while (have_posts()) : the_post(); ?>
<div class="col-sm-6">
<div class="blog-sec">
<?php get_template_part('content', get_post_format()); ?>
</div> <!-- blog-sec ends here -->
<?php endwhile; ?>
</div> <!-- col-sm-6 ends here -->
<?php pagination_numeric_posts_nav(); ?>
</div> <!-- exerpts-wrap fix ends here -->
任何建议都将不胜感激。
我一直在寻找这个问题的解决方案,现在我找到了一个解决方案。我在回答我自己的问题,这样对其他面临同样问题的人会有所帮助。
为了解决这个问题,我只安装了一个名为"Cat Post Type"的插件,其他什么都没有,现在一切都很好。
我知道我的代码没有错。插件并没有在管理部分添加任何可视化内容,它只是添加了一些修复此问题的代码。
祝你好运!