简体   繁体   English

用类别或标签中的帖子填充WordPress页面

[英]Populating a WordPress Page with posts from a Category or Tag

I have a WordPress for my science journalism blog and I would like to add a page that contains a subset of the blog posts. 我的科学新闻博客使用WordPress,我想添加一个页面,其中包含部分博客文章。 For example, having a page populated by a certain category (ie review articles) or tags (ie physics). 例如,具有由某个类别(即评论文章)或标签(即物理学)填充的页面。

There seems to be a way to do this by making a new php page , but I am not sure how to get to a blank template to add the code base. 似乎有一种方法可以通过制作一个新的php页面来实现 ,但是我不确定如何获取空白模板来添加代码库。

Alternatively, I would prefer having a way to do this without having to mess with the code at all. 或者,我希望有一种方法来执行此操作而不必完全弄乱代码。 Any help would be much appreciated. 任何帮助将非常感激。 Thanks! 谢谢!

This happens automatically with WordPress; WordPress会自动发生这种情况; read the docs: 阅读文档:

When a viewer clicks on a link to one of the Categories on your site, he or she is taken to a page listing the Posts in that particular Category in chronological order, from newest Posts at the top to oldest at the bottom. 当查看者单击指向您网站上类别之一的链接时,他或她将被带到一个页面,该页面按时间顺序列出该特定类别中的帖子,从顶部的最新帖子到底部的最旧帖子。

Read https://codex.wordpress.org/Category_Templates 阅读https://codex.wordpress.org/Category_Templates

You don't have to make a category or tag template page, but you can if you want to. 不必制作类别或标签模板页面,但是可以。 This is theme-dependent; 这取决于主题; your theme may already have different archive page templates. 您的主题可能已经具有不同的存档页面模板。

The URL for a category or tag archive page will be: 类别或标签存档页面的URL将是:

example.net/category_base/category_name example.net/category_base/category_name

example.net/tag_base/tag_name example.net/tag_base/tag_name

Read https://codex.wordpress.org/Using_Permalinks#Category_base_and_Tag_base 阅读https://codex.wordpress.org/Using_Permalinks#Category_base_and_Tag_base

Go to Appearance>Settings>Reading to set number of posts per page and either excerpt or full post. 转到外观>设置>阅读以设置每页的帖子数以及摘要或完整帖子。

I think you should be able to get at a category by going to http://example.com/category/mycategory 我认为您应该可以通过转到http://example.com/category/mycategory来获得一个类别

And to tags by visiting http://example.com/tag/mytag 并通过访问http://example.com/tag/mytag来标记

You should be able to add categories to the main menu, and add tag pages via a custom link OR use a tag cloud? 您应该能够在主菜单中添加类别,并通过自定义链接添加标签页,还是使用标签云?

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM