wordpress添加媒体
WordPress comes with the ability to sort your content into categories, tags, and taxonomies. One of the major difference between categories and tags is that categories can have subcategories or child categories. In this article, we will show you how to add categories and subcategories in WordPress and how to get the most SEO benefit out of categories.
WordPress可以将您的内容分类为类别,标签和分类法。 类别和标签之间的主要区别之一是类别可以具有子类别或子类别。 在本文中,我们将向您展示如何在WordPress中添加类别和子类别,以及如何从类别中获得最大的SEO收益。
(Understanding Parent, Child, and Sibling Categories in WordPress)
Categories are a powerful tool and can be used not only to sort your content, but to also develop a proper site structure that is meaningful and semantic.
类别是一个功能强大的工具,不仅可以用于对您的内容进行排序,还可以用于开发有意义且具有语义的适当站点结构。
Before moving forward, we recommend you to read our guide on categories and tags. It will help you understand how categories are different than tags, why they should not be confused or mixed up, and lastly how to properly use categories. Once you have read it, come back here and we will continue.
在继续之前,我们建议您阅读有关类别和标签的指南。 它将帮助您了解类别与标签的不同之处,为什么不应混淆或混淆它们,以及最后如何正确使用类别。 阅读完后,请回到此处,我们将继续。
Let’s suppose you are creating a travel website for different destinations around the world. You may want users to be able to find articles by city and by country as well.
假设您要为世界各地的不同目的地创建一个旅游网站。 您可能希望用户也能够按城市和国家查找文章。
For example, you can add United States and then post articles for New York City, Los Angeles, Chicago, etc. This is where you can utilize child categories. United States would become a parent category, and cities can become child categories.
例如,您可以添加美国,然后发布有关纽约市,洛杉矶,芝加哥等的文章。在这里,您可以利用子类别。 美国将成为父类别,城市将成为子类别。
It is important to note that a post filed under a child category does not need to be filed under parent category. For example, if you assign a post New York City as category which is a child category of United States, then you are free to choose whether you want the post to be filed under both or just the child category.
重要的是要注意,在子类别下提交的帖子无需在父类别下提交。 例如,如果您将职位纽约指定为美国的子类别,则可以自由选择是将帖子归档在两个子类别下还是仅在子类别下归档。
If you choose to file a post under the child category but not under the parent category, then your post will appear only on the archive pages of child category. This particularly helpful when you want to avoid duplicate content.
如果您选择在子类别下而不是在父类别下提交帖子,则您的帖子将仅出现在子类别的存档页面上。 当您要避免重复内容时,这特别有用。
Let’s suppose you have created a parent category United States and it has only one child category, New York City. Now if you file a post under both parent and child categories, then the archive pages of both categories will be completely identical.
假设您创建了一个父类别“美国”,并且只有一个子类别“纽约市”。 现在,如果您同时在父类别和子类别下提交帖子,那么这两个类别的存档页面将完全相同。
Having said that, let’s take a look at how to add categories and child categories in WordPress.
话虽如此,让我们看一下如何在WordPress中添加类别和子类别。
(Adding Category in WordPress)
You can add a new category in WordPress when writing a post. On the post edit screen, scroll down to the categories meta box and click on Add New Category link.
您可以在撰写帖子时在WordPress中添加新类别。 在帖子编辑屏幕上,向下滚动到“类别”元框,然后单击“添加新类别”链接。
You can also add a new category without editing a post. Simply visit Posts » Categories page and add your new category. This method is particularly useful, if you want to create all your categories before adding content.
您也可以添加新类别而不编辑帖子。 只需访问帖子»类别页面并添加您的新类别。 如果要在添加内容之前创建所有类别,则此方法特别有用。
(Adding Child Category in WordPress)
You can edit child categories the same way you added your parent categories. On the post edit screen, scroll down to categories section and click on the Add New Category link. This will show you text field for adding new category name and a dropdown menu to select the parent category.
您可以按照添加父类别的相同方式来编辑子类别。 在帖子编辑屏幕上,向下滚动到“类别”部分,然后单击“添加新类别”链接。 这将显示用于添加新类别名称的文本字段以及用于选择父类别的下拉菜单。
Similarly, you can also visit Pages » Categories page. Add the name for your child category and then select the parent category from the Parent dropdown menu.
同样,您也可以访问页面»类别页面。 为您的子类别添加名称,然后从“父”下拉菜单中选择父类别。
(SEO Benefits of Category Based Site Structure)
If you are using SEO Friendly URLs, then your child category URL will look like this.
如果您使用的是SEO友好URL ,那么您的子类别URL将如下所示。
http://example.com/category/united-states/new-york-city/
http://example.com/category/united-states/new-york-city/
This is much more meaningful and helps search engines and users understand what your page is about. You also get a chance to add keywords into your URL, Keywords help people find content on search engines.
这更有意义,并且可以帮助搜索引擎和用户了解您的网页内容。 您还可以将关键字添加到您的URL中,关键字可帮助人们在搜索引擎上查找内容。
You can get rid of the ‘category’ prefix from your category URLs by installing FV Top Level Categories plugin. Simply install the plugin and it will remove category base from URLs of your category archive pages. You will get your category archive page like this:
您可以通过安装FV顶级类别插件来摆脱类别URL中的“类别”前缀。 只需安装插件,它就会从类别存档页面的URL中删除类别库。 您将获得如下类别存档页面:
http://example.com/united-states/new-york-city/
http://example.com/united-states/new-york-city/
(Display Categories and Child Categories in WordPress Sidebar)
Your WordPress theme will automatically show the categories for each post. To display all your categories on your blog’s sidebar, you need to visit Appearance » Widgets page. Drag and drop categories widget from the list of available widgets to a sidebar.
您的WordPress主题将自动显示每个帖子的类别。 要在博客的侧边栏上显示所有类别,您需要访问Appearance»Widgets页面。 将类别小部件从可用小部件列表中拖放到侧边栏。
In the categories widget’s settings, check the box next to ‘Show hierarchy’ option and click on the save button. Visit your site and WordPress will show your categories with child categories aligned under the parent category.
在类别小部件的设置中,选中“显示层次结构”选项旁边的框,然后单击“保存”按钮。 访问您的网站,WordPress将显示您的类别,其子类别在父类别下对齐。
We hope this article helped you learn how to add categories and child categories in WordPress. You may also want to take a look these most wanted category hacks and plugins for WordPress.
我们希望本文能帮助您学习如何在WordPress中添加类别和子类别。 您可能还想看看WordPress这些最想要的类别hack和插件 。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/beginners-guide/how-to-add-categories-and-subcategories-to-wordpress/
wordpress添加媒体