如何检查一个类别的帖子有多少在另一个类别WordPress的前10个帖子中
嗨,我有一个最新新闻类别,我在首页输出了那只猫的 10 篇帖子,
我也有以下类别 -环境 -政治 -体育
和我在首页中为每个帖子输出 5 个帖子,
我想检查我是否在最新新闻类别的前 10 个帖子中包含 3 个来自政治的帖子,如何将政治猫中显示的帖子抵消 3 个帖子那只猫,所以我的首页上没有重复的内容。假设我在最新的新闻猫中有 5 个关于环境的帖子。好吧,我想将环境猫中的帖子抵消 5 等。
希望有人能帮助我:D 谢谢!
hi i have a category of latest news and i output 10 posts for that cat in the frontpage
I also have categories for
-enviroment
-politics
-sports
and i output 5 posts for each one in the frontpage
i want to check if i have lets say 3 posts from politics in the first 10 posts in the latest news category how to ofsset the posts shown in the politics cat by 3 posts in the that cat so i dont have duplicate content on the front page. lets say i had 5 posts for the enviroement in the latest news cat. well i would want to offset the posts in the enviroment cat by 5 and so on.
Hope someone can help me out :D THANKS!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例如,当您执行循环以在类别环境中显示帖子时,您可以存储 post->ID,然后将其用作最新循环中的“排除”参数。
它可能是这样的:
When you do the loop to show posts in category enviroment, for example, you could store the post->ID, then you use it as "exclude" parameter in your latest loop..
It could be something like this: