【问题标题】:How to Exclude Category Posts in WordPress Main Blog page?如何在 WordPress 主博客页面中排除类别帖子?
【发布时间】:2015-06-23 20:03:21
【问题描述】:

我正在尝试排除“新闻”类别的帖子,但我似乎遇到了一些问题。我没有编写原始代码,也没有真正使用过 WordPress,因此任何相关资源和解决方案都会有所帮助。这是当前正在使用的代码,但显示了包括“新闻”在内的所有帖子

<?php query_posts('post_type=post&post_status=publish&paged='. get_query_var('paged') .'&cat=-news'); ?>

【问题讨论】:

    标签: php wordpress content-management


    【解决方案1】:

    不要在参数中使用'news',而是将其更改为可以通过转到posts>categories>news page's url找到的类别的ID。它应该类似于 category&tag_ID=52&post_type=post 其中 52 是 id。

    【讨论】:

      猜你喜欢
      • 2014-01-14
      • 1970-01-01
      • 2023-03-27
      • 2021-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 1970-01-01
      相关资源
      最近更新 更多