wordpress标签插件_WordPress标签解释

本文深入解析WordPress中的标签功能,阐述其在内容分类中的独特价值,包括如何创建、编辑和删除标签,以及如何利用默认小部件展示标签。通过实例,展示了标签与类别的互补作用,帮助用户更高效地组织和搜索内容。
摘要由CSDN通过智能技术生成

wordpress标签插件

By default there are two features in WordPress which help us to sort our content: categories and tags. Some plugins and themes add their own taxonomies but these two are the most commonly used, as everyone has them.

默认情况下,WordPress中有两个功能可帮助我们对内容进行排序:类别和标签。 一些插件和主题添加了自己的分类法,但是这两个是最常用的,因为每个人都拥有它们。

But some users don’t know why we have both of these. After all, categories are fine to sort posts, so a second way to sort them can seem useless. But it’s not the case.

但是有些用户不知道为什么我们同时拥有这两个。 毕竟,类别可以很好地对帖子进行排序,因此对它们进行排序的第二种方法似乎毫无用处。 但事实并非如此。

In this article, we will see why WordPress tags are useful. Right after, as you’ll surely want to use them, I’ll show you how to add, edit and delete tags. We’ll finish by covering the default widget WordPress provides to display tags.

在本文中,我们将了解为什么WordPress标签有用。 紧接着,您一定会想要使用它们,我将向您展示如何添加,编辑和删除标签。 我们将介绍WordPress提供的用于显示标签的默认小部件。

If you’re not familiar with how categories are used in WordPress you can refer to my article WordPress Categories Explained.

如果您不熟悉WordPress中类别的用法,可以参考我的文章WordPress类别解释

标签真的有用吗? (Are Tags Really Useful?)

I sometimes encounter people who ask if tags can be useful, and how to use them. As a blogger I write several articles per day so I know that tags can be really useful. Now it’s time for me to show you exactly how useful they can be.

有时我会遇到有人问标签是否有用以及如何使用它们。 作为博客作者,我每天都会写几篇文章,因此我知道标签确实很有用。 现在是时候让我向您展示它们的实用性。

Tags can complete the sorting you do with categories. However, they aren’t subcategories, and suggesting that they’re subcategories is wrong (you can already create subcategories with the categories system).

标签可以完成您对类别进行的排序。 但是,它们不是子类别,表明它们是子类别是错误的(您已经可以使用类别系统创建子类别)。

Tags are keywords.

标签是关键词。

It’s a very short definition (from my point of view) but it’s the one you should keep in mind when you want to add a tag to your post.

从我的角度来看,这是一个非常简短的定义,但是当您要在帖子中添加标签时,应该牢记这一定义。

Let’s take an example to help clarify the definition. Assume that you have a category named “Pictures” with a subcategory named “Cute Animals”. One day, you’ll post a picture of a cute kitty in this category. For this post, you can create a tag named “Kitties” or “Cats”, and you’ll give this tag to all your cat pictures.

让我们举个例子来帮助澄清定义。 假设您有一个名为“图片”的类别,并且有一个名为“可爱的动物”的子类别。 有一天,您将在该类别中张贴一张可爱小猫的图片。 对于此帖子,您可以创建一个名为“ Kitty”或“ Cats”的标签,并将该标签提供给所有猫图片。

At this point, tags might still seem useless, since a “Cats” subcategory could handle this.

在这一点上,标签似乎仍然没有用,因为“猫”子类别可以处理此问题。

Now let’s assume that you have another category named “Around the Web” where you post things you come across that are interesting and must be shared. One day, you find an infinitely interesting website with a lot of cats. For that post, you could still create a “Cats” subcategory under “Around the Web”, but that’s two categories with the same name. This is a good example of where tags might be a better choice.

现在,我们假设您有另一个名为“网络周围”的类别,您可以在其中发布遇到的有趣且必须共享的事物。 有一天,您会发现一个无限有趣的网站,里面有很多猫。 对于该帖子,您仍然可以在“网上”下创建“猫”子类别,但这是两个名称相同的类别。 这是标记可能是更好选择的一个很好的例子。

It’s just an example, but it helps demonstrate that tags are like categories, but they aren’t categories, they complement them. They are a way to sort posts, but they can appear in several categories. That’s why we can’t see them as simple subcategories.

这只是一个示例,但它有助于证明标签就像类别,但不是类别,而是对它们的补充。 它们是对帖子进行排序的一种方式,但是它们可以出现在多个类别中。 这就是为什么我们不能将它们视为简单的子类别。

Thinking about reusing the tags you want to add is a good idea. Using tags for sorting your posts is fine, but having dozens of tags per post is not. To find the right balance, think about a book index: in this index you want to find a complete list of keywords, but not a list polluted by useless words like “the”.

考虑重新使用要添加的标签是一个好主意。 使用标签对帖子进行排序是可以的,但每个帖子都不能使用几十个标签。 为了找到适当的平衡,请考虑一下图书索引:在该索引中,您要查找关键字的完整列表,而不是被“ the”之类的无用字污染的列表。

管理标签 (Managing Tags)

添加标签 (Adding a Tag)

从标签管理器 (From the Tags Manager)

You can find the list of the tags you use in the “Tags” entry of the “Posts” menu in your administration panel. The structure of this page should be familiar to you if you have used the Categories manager, as it is essentially the same.

您可以在管理面板中“帖子”菜单的“标签”条目中找到要使用的标签列表。 如果您使用了类别管理器,则此页面的结构应该为您熟悉,因为它基本上是相同的。

To create a new tag you can, as for a category, use the form on the left. There are three fields, but only the first one is required: the name of the tag, the one which will be seen by the user.

要创建新标签,您可以使用左侧的表格作为类别。 有三个字段,但仅第一个字段是必需的:标签名称,用户将看到该名称。

The slug is used in the URLs if you enabled URL Rewriting. Typically, it’s the name of the tag, optimized for a URL (in lowercase, without any space or special character). If you leave this field blank, then WordPress will automatically generate the slug from the name of the tag, so if that’s what you would have done anyway you can leave this field blank.

如果启用了URL重写,则将在URL中使用该段标记。 通常,它是标记的名称,针对URL优化(小写,没有任何空格或特殊字符)。 如果将此字段保留为空白,则WordPress将根据标签名称自动生成该条,因此,无论如何,您都可以将该字段保留为空白。

You can add a description to your tag, but it’s optional. Some themes display the description when the user displays the list of posts which have a given tag assigned to them. However, it’s not a feature used by every theme, so before filling a potentially useless field, be sure that your theme will display this description, or that you want to use the description to define the role of the tag in the administration panel.

您可以在标签中添加说明,但这是可选的。 当用户显示为其分配了给定标签的帖子列表时,某些主题将显示说明。 但是,它不是每个主题都使用的功能,因此在填充可能无用的字段之前,请确保主题将显示此描述,或者您要使用该描述在管理面板中定义标签的角色。

add a tag

Contrary to what we found in categories, there’s no relationships in the tags: you can not set a tag as a child of another tag. A “child keyword” doesn’t make much sense.

与我们在类别中发现的相反,标记中没有任何关系:您不能将标记设置为另一个标记的子代。 “子关键字”没有多大意义。

来自编辑 (From the Editor)

If you want to use tags, it’s worth knowing that there is another way to add a tag, more used in practice as it takes place in the editor.

如果要使用标签,则值得一提的是,还有另一种添加标签的方法,实际上是在编辑器中使用的。

When you add a new post or when you edit one, you can find a “Tags” block. In this block you’ll find a field in which you can type your tag and hit the “Add” button.

添加新帖子或编辑帖子时,可以找到“标签”块。 在此块中,您将找到一个字段,您可以在其中键入标签并点击“添加”按钮。

When you hit this button, WordPress will associate your post with the tag you just typed. If this tag wasn’t already created before, it will now exist and you will be able to use it in other posts.

当您按下此按钮时,WordPress会将您的帖子与您刚刚键入的标签相关联。 如果以前没有创建此标签,则该标签现在将存在,您可以在其他帖子中使用它。

To go faster, you can simply hit the “Enter” key on your keyboard instead of hitting the “Add” button. You can also assign several tags by separating them with commas. As a consequence, you can’t use a comma inside the name of a new tag from this field (you can, but only from the Tags manager seen above). To finish, note that WordPress will automatically retrieve for you the tags which contain the letters you are typing, which can be useful to be sure you won’t create by accident a new tag too close to an existing one.

为了更快,您只需按键盘上的“ Enter”键,而不是按“ Add”按钮。 您还可以通过用逗号分隔标签来分配多个标签。 因此,您不能在此字段的新标签名称中使用逗号(可以,但只能从上面显示的标签管理器中使用)。 最后,请注意WordPress将自动为您检索包含您正在键入的字母的标签,这对于确保您不会偶然创建的新标签与现有标签太有用可能很有用。

Add a WordPress tag

Below this field you’ll find the list of tags used for the current post. You can hit the cross icon visible next to each tag to remove it from the post you are editing. However, this won’t delete the tag: it will still exist in the tags list, even if no post is using it.

在此字段下,您会找到用于当前帖子的标签列表。 您可以点击每个标签旁边的十字图标,将其从正在编辑的帖子中删除。 但是,这不会删除标签:即使没有帖子在使用,它仍将存在于标签列表中。

编辑和删除标签 (Editing and Deleting a Tag)

Editing or deleting a tag is exactly as per editing or deleting a category. You find the right tag in the list (in the Tags manager), you hover over it, and the options are displayed.

编辑或删除标签与编辑或删除类别完全相同。 您在列表中(在标签管理器中)找到了正确的标签,将鼠标悬停在该标签上,然后显示选项。

Edit or delete a tag

Be careful: deleting a tag can’t be undone. If some posts were using this tag, it will be removed from the list of tags used.

请注意:删除标签无法撤消。 如果某些帖子正在使用此标签,则将从使用的标签列表中将其删除。

If you edit a tag, the modification will be visible on posts the tag is assigned to. This can be useful if you added a tag in several posts and noticed a mistake in the tag name: by editing the tag itself, the mistake will be fixed in every post.

如果您编辑标签,则修改将在分配标签的帖子上看到。 如果您在多个帖子中添加了标签并注意到标签名称中的错误,这将很有用:通过编辑标签本身,错误将在每个帖子中得到解决。

使用默认窗口小部件显示标签 (Displaying the Tags with the Default Widget)

Your theme should normally display the tags used on every post. But what if you want to display the list of tags you use everywhere, as for the categories?

您的主题通常应显示每个帖子上使用的标签。 但是,如果要显示在各处使用的标签列表以及类别,该怎么办?

A list of tags can be useful to let your users know the topics you talk about on your blog. To let you do that, WordPress provides a default widget allowing you to display a “tag cloud”.

标记列表可以帮助您的用户了解您在博客上谈论的主题。 为了做到这一点,WordPress提供了一个默认的小部件,可让您显示“标签云”。

The tag cloud is basically a succession of links pointing to the tags you use, separated by a space. A bit of CSS is used to enhance it.

标签云基本上是指向您使用的标签的一系列链接,用空格隔开。 一些CSS用于增强它。

Tag Cloud

By default, WordPress sets the font size of each link, in a style attribute. This size is calculated from the number of posts using each tag: the more a tag is used, the larger it will be. Then, your visitors can directly identify the more recurrent topics on your blog: they will be displayed in a bigger size than the other ones.

默认情况下,WordPress在style属性中设置每个链接的字体大小。 该大小是根据使用每个标签的帖子数计算得出的:标签使用的次数越多,标签的大小就会越大。 然后,您的访问者可以直接在您的博客上标识更多经常性的主题:它们的显示大小比其他主题大。

Note that, if you use many tags, this widget won’t display all of them. In fact, WordPress will only display the 45 most used tags. That way, you can use hundreds of tags without worrying about the size of this widget.

请注意,如果您使用许多标签,则此小部件将不会显示所有标签。 实际上,WordPress仅会显示45个最常用的标签。 这样,您可以使用数百个标签,而不必担心此小部件的大小。

结论 (In Conclusion)

Tags are a good way to sort your content using keywords. They can help your users find the topics of interest to them, and they can be useful in many blogs.

标签是使用关键字对内容进行排序的好方法。 它们可以帮助您的用户找到他们感兴趣的主题,并且它们在许多博客中都非常有用。

For example, if you have a cooking blog, you can use tags to help classify your content by the ingredients used. If your blog is focused on high-tech devices, you can tag your posts according to the device you are discussing. There are endless possibilities.

例如,如果您有一个烹饪博客,则可以使用标签来帮助根据所使用的成分对内容进行分类。 如果您的博客关注高科技设备,则可以根据您正在讨论的设备来标记帖子。 有无穷的可能性。

In this article I described how tags work and how to use them. In a future article, we will go further, by playing with the Tags API in order to see how to display our tags in the way we want.

在本文中,我描述了标签如何工作以及如何使用它们。 在以后的文章中,我们将更进一步,通过使用Tags API,以了解如何以所需方式显示我们的标签。

翻译自: https://www.sitepoint.com/wordpress-tags-explained/

wordpress标签插件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值