如何在WordPress中显示最受欢迎的标签

Do you want to display the most popular tags used on your WordPress site? Tags and categories are the two default ways to sort your content in WordPress. Categories often get more exposure due to their broader scope, which gives tags a little less attention. In this article, we will show you how to easily display your most popular tags in WordPress.

您是否要显示WordPress网站上使用的最受欢迎标签? 标签和类别是在WordPress中对内容进行排序的两种默认方法。 由于类别的范围更广,因此类别通常会获得更多的展示机会,从而使标签的关注度降低。 在本文中,我们将向您展示如何轻松地在WordPress中显示最受欢迎的标签。

How to display most popular tags in WordPress
为什么以及何时应该在WordPress中显示最受欢迎的标签 (Why and When You Should Display Most Popular Tags in WordPress)

Categories and tags are the two default taxonomies to sort your articles in WordPress. Categories are used for broader topics or sections on your website while tags are well-suited to specific ideas within the context of your articles.

类别和标签是在WordPress中对您的文章进行排序的两个默认分类法 。 类别用于网站上更广泛的主题或部分,而标签则非常适合您文章上下文中的特定思想。

Often beginners end up using them incorrectly, but there are easy tools which allow you to merge categories and tags and even convert them.

通常,初学者最终会错误地使用它们,但是有一些简单的工具可让您合并类别和标签 ,甚至进行转换。

Once you start using categories and tags correctly, you’ll likely have more tags on your website than categories. Due to their broader scope, you can put categories in navigation menus, but your tags may often remain less explored.

一旦开始正确使用类别和标签,您的网站上的标签可能会比类别更多。 由于它们的范围更广,因此您可以在导航菜单中放置类别 ,但是您的标签可能经常没有被浏览。

One way to deal with this is by adding the default tag cloud widget by going to the Appearance » Widgets page, and add Tag Cloud widget to a sidebar.

解决此问题的一种方法是,通过转到“ 外观»小部件”页面添加默认标签云小部件 ,并将标签云小部件添加到侧边栏。

Default tag cloud widget in WordPress

However, you will notice that the default tags widget will show all your tags alphabetically. You cannot rearrange their order or limit the number of tags to be displayed.

但是,您会注意到默认标签小部件将按字母顺序显示所有标签。 您不能重新排列其顺序或限制要显示的标签数量。

You can solve this, by displaying the most popular or most often used tags on your WordPress site.

您可以通过在WordPress网站上显示最受欢迎或最常用的标签来解决此问题。

This will allow your users to quickly get an idea on what topics are more frequently discussed on your site. It will also help them discover more content, which means more page views and user engagement.

这将使您的用户快速了解您的站点上最经常讨论的主题。 它还将帮助他们发现更多内容,这意味着更多的页面浏览量和用户参与度。

Now let’s take a look at how to easily display your most popular tags in WordPress.

现在,让我们看一下如何轻松地在WordPress中显示最受欢迎的标签。

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

1.使用插件显示WordPress中最受欢迎的标签 (1. Display Most Popular Tags in WordPress Using Plugin)

This method is easier and recommended for most users.

此方法更简单,建议大多数用户使用。

First thing you need to do is install and activate the Simple Tags plugin. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并激活简单标签插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to visit Appearance » Widgets page and add ‘Tag Cloud (Simple Tags)’ widget to the sidebar.

激活后,您需要访问外观»小部件页面,并将“标签云(简单标签)”小部件添加到侧边栏中。

Simple tag cloud settings

The widget will expand, and you will be able to see its settings.

小部件将展开,您将能够看到其设置。

Here you can select the number of tags you want to display, font sizes, colors, etc.

在这里,您可以选择要显示的标签数量,字体大小,颜色等。

To display your tags by popularity, make sure you select count for ‘Order by for display tags’ and descending for ‘Order for display tags’ options.

要按受欢迎程度显示标签,请确保为“显示标签订购依据”选择计数,并为“显示标签订购依序”选项递减。

Don’t forget to click on the save button to store your widget settings.

不要忘记单击“保存”按钮来存储您的小部件设置。

You can now visit your website to see your popular tags in action.

现在,您可以访问您的网站以查看流行的标签。

Simple popular tags cloud in WordPress
手动显示WordPress中的热门标签 (Display Popular Tags in WordPress Manually)

This method requires you to add code in your WordPress theme files. If you haven’t done this before, then please see our guide on how to copy and paste code in WordPress.

此方法要求您在WordPress主题文件中添加代码。 如果您之前没有做过,请参阅我们的指南, 了解如何在WordPress中复制和粘贴代码

First, you need to add this code to your theme’s functions.php file or a site-specific plugin.

首先,您需要将此代码添加到主题的functions.php文件或特定站点的插件中


function wpb_tag_cloud() { 
$tags = get_tags();
$args = array(
	'smallest'                  => 10, 
	'largest'                   => 22,
	'unit'                      => 'px', 
	'number'                    => 10,  
	'format'                    => 'flat',
	'separator'                 => " ",
	'orderby'                   => 'count', 
	'order'                     => 'DESC',
	'show_count' 				=> 1,
	'echo'						=> false
); 

$tag_string = wp_generate_tag_cloud( $tags, $args );

return $tag_string; 

} 
// Add a shortcode so that we can use it in widgets, posts, and pages
add_shortcode('wpb_popular_tags', 'wpb_tag_cloud'); 

// Enable shortcode execution in text widget
add_filter ('widget_text', 'do_shortcode'); 


This code simply generates the top 10 tags from your website in a cloud with number of posts in each tag. After that it creates a shortcode wpb_popular_tags and enables shortcode in text widget.

此代码仅会在云中从您的网站生成前10个标签,每个标签中的帖子数。 之后,它将创建一个简码 wpb_popular_tags在文本小部件中启用简码

You can now add shortcode [wpb_popular_tags] in any post, page, or widget to display your most popular tags.

现在,您可以在任何帖子,页面或小部件中添加简码[wpb_popular_tags] ,以显示最受欢迎的标签。

Popular tags with post count

Want to style your tags differently? Check out our guide on how to style tags in WordPress for detailed instructions and example.

想要以不同的方式设置标签样式吗? 查看有关如何在WordPress中设置标签样式的指南, 获取详细说明和示例。

We hope this article helped you learn how to display most popular tags in WordPress. You may also want to see our list of most wanted WordPress tips, tricks, and hacks for beginners.

我们希望本文能帮助您学习如何在WordPress中显示最受欢迎的标签。 您可能还希望查看初学者最想要的WordPress技巧,窍门和黑客列表。

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视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/plugins/how-to-display-most-popular-tags-in-wordpress/

逛论坛的时候,你是否注意到有些论坛里的朋友,他们的签名非常的个性,所谓的个性不是指别的,而是指他们的签名连接回他们的博客,而且还把博客的文章显示出来,看上去很不错,我们在论坛里发帖,一方面是为了认识更多的朋友,另一方面是为了推广自己的网站,所以,如何更好的利用论坛资源的标签档,进行推广网站,是很值得研究的。 那么,今天就介绍这款论坛图片签名插件。使用此插件,当我们在论坛里的签名档加入相应代码后,我们的签名档里就会自动显示博客的文章。 插件功能介绍:生成一个论坛签名图片,在该图片上自动显示你的Wordpress博客上的最新文章。 安装步骤: 下载该插件,解压缩后传到你的wordpress程序的/wp-content/plugins/ 目录下 将/wp-content/plugins/ 目录下的 titletopng目录权限设为777 (即让该目录可写 WINDOWS服务器请忽略该步) 在后台插件管理处选择开启”图片签名插件”,在后台设置处选择title2png进行设置 /wp-content/plugins/titletopng/title.png 即为生成后的图片文件,在论坛签名请用如下代码][img]http://www.yourdomain.com/wp-content/plugins/titletopng/title.png[/img] 则可自动显示你的Wordpress最新文章了 注:把yourdomain替换为你自己的域名 常见问题 1:如何修改背景图片 请用你的PNG格式的图片替换掉插件目录下的pic.png 文件 2:如何修改字体? 用你的字体文件替换掉本插件目录的msyh.ttf文件即可 3:如何修改字体颜色? 在后台设置只有3组数字供大家设置,大家肯定不知道哪些数字表示什么颜色,这就需要大家用一些画图工具了,用photoshop等来查询就可以了,也有一些在线工具但是蜗牛我还没找到 4:如何定位文本块开始的坐标? 同上,还是要用到画图工具,要么大家就慢慢试 5:怎么生成不了图片? 请检查你的插件目录权限,若没开启写权限的话,则图片无法生成
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值