温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.t5a.com/wordpress/limit-tags-in-tag-cloud-widget
点击访问原文链接

How to Limit Tags in Tag Cloud Widget in WordPress

How to Limit Tags in Tag Cloud Widget in WordPress Start a Website Awards Guides WordPress Training Coupons Top Five AdvisorGuides → WordPress Training → How to Limit Tags in Tag Cloud Widget in WordPress How to Limit Tags in Tag Cloud Widget in WordPress Have you ever tried to use the Tag Cloud widget in your WordPress but it appeared way too messy to use? Here at Top Five Advisor, we have over 100 tags that we have setup and we’re just getting started. Unfortunately, the default display of the tag cloud widget is to show all of your tags and increase in size depending on the tag use on your content.

You may notice that we have the following screenshot on the left displaying on the bottom of our website and you may be wondering how we did it.

Thankfully, all you need to do is make a quick edit in your functions.php file and you’ll be able to customize how many tags will appear in your widget area.

Simply change the number 5 on the “$args[‘number’] = 5;” line and the number you set will be the total tags allowed to be shown in that widget area, whether it is in your sidebar or footer areas.

Here’s the code snippet that you need to add to your functions.php:

// Limit Tags in Tag Cloud Widget add_filter('widget_tag_cloud_args', 'tag_widget_limit'); function tag_widget_limit($args){ if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){ $args['number'] = 5; // What this will do is show your most popular tags in the tag cloud depending on the number you set. In our case, the screenshot in this post represents the 5 most popular tags as of the time of this posting.

Scott Buehler May 7, 2015 WordPress Training About Scott Buehler   Scott is the owner and founder of Top Five Advisor. He specializes in business to business products and services. He offers digital marketing services to any local business that wants to drive traffic and customers from the Internet including search, pay per click and social media marketing. This page is maintained by Scott Buehler.

Follow Us on Social Media

Follow @TopFiveAdvisor http://pinterest.com/http://topfiveadvisor Privacy Policy Terms of Service

Copyright 2012-2018 by Top Five Advisor.

Want to support our work? We may earn a referral fee when you buy products or services from this site. Learn more...

智能索引记录