【问题标题】:Pagination issue in a category page [WordPress]类别页面中的分页问题 [WordPress]
【发布时间】:2014-10-03 07:07:31
【问题描述】:

我想显示所有自定义帖子类型中的一个类别帖子,我的代码做得很好,但分页停止工作。 这是我的代码:

<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 -->

任何建议将不胜感激。

【问题讨论】:

  • 请告诉什么是“pagination_numeric_posts_nav”,它似乎不是 WordPress 的核心功能。
  • "pagination_numeric_posts_nav" 是我为分页创建的自定义函数,除此页面外,它在整个网站上都可以正常工作。

标签: php wordpress pagination


【解决方案1】:

很长时间以来我一直在寻找这个问题的解决方案,现在我找到了解决方案。 我正在回答我自己的问题,因此它可以帮助面临同样问题的其他人。

我为解决这个问题所做的只是安装一个名为“Cat Post Type”的插件,仅此而已,现在一切正常。

我知道我的代码没有错。插件不会在管理部分视觉上添加任何东西,它只是添加一些代码来解决这个问题。

祝你好运!

【讨论】:

    猜你喜欢
    • 2013-09-23
    • 1970-01-01
    • 1970-01-01
    • 2019-04-08
    • 2011-08-01
    • 1970-01-01
    • 2017-07-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多