如何在WordPress中设置标签样式

您所在的位置:网站首页 html如何链接css 如何在WordPress中设置标签样式

如何在WordPress中设置标签样式

2023-03-12 05:41| 来源: 网络整理| 查看: 265

中设置标签样式

WordPress allows you to sort your content in . By default it comes with . While categories can be used to sort your content

into different sections, tags can be used to sort content into more specific topics. You can display tags used on your site in

a tag cloud or in a list format. In this article, we will show you how to style tags in WordPress.

WordPress允许你在你的内容进⾏分类 。 默认情况下,它带有 。 虽然类别可⽤于将内容分类为不同的部分,但标签可⽤于将内容分类为

更具体的主题。 您可以标签云或列表格式显⽰⽹站上使⽤的标签。 在本⽂中,我们将向您展⽰如何在WordPress中设置标签样式。

WordPress

中显⽰所有带有计数的标签

 (Displaying All Tags With Post Counts in WordPress)

Some popular websites display their most popular tags as topics on their or in the footer area. Here is how you can display

all your post tags, with post count, and without using the tag cloud.

⼀些受欢迎的⽹站在其或页脚区域中将最受欢迎的标签显⽰为主题。 这是不使⽤标签云即可显⽰所有帖⼦标签以及帖⼦数的⽅法。

First thing you need to do is copy and paste this code in your theme’s file or plugin.

您需要做的第⼀件事是将此代码复制并粘贴到主题的⽂件或于插件中。

function wpb_tags() { 

$wpbtags =  get_tags();

foreach ($wpbtags as $tag) { 

$string .= ''. $tag->name . ''. $tag->count .'<

return $string;

add_shortcode('wpbtags' , 'wpb_tags' );

This code simply displays all your tags with their post count next to them. However, to display it on your archives page or in

a widget you need to use this shortcode:

这段代码仅显⽰所有标签及其旁边的帖⼦数。 但是,要在存档页⾯或⼩部件中显⽰它,您需要使⽤以下短代码:

[wpbtags]

[wpbtags]

Using this code alone will just show tag links and post count next to them. It will not make it look pretty. Lets add some to

make it pretty. Copy and paste this CSS into your theme’s stylesheet.

仅使⽤此代码将仅在其旁边显⽰标签链接并发布数量。 它不会使它看起来很漂亮。 让我们添加⼀些使其漂亮。 将此CSS复制并粘贴到主题

的样式表中。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3