widgets - Sorting Tag Cloud by Popularity

So I have the default Wordpress Tag Cloud Widget on my sidebarfooter and I found the following code to limit the number

So I have the default Wordpress Tag Cloud Widget on my sidebar/footer and I found the following code to limit the number that it's showing because it took up a ton of space. This code however is not actually showing the most popular tags, and I don't know what is causing this.

function set_widget_tag_cloud_args($args) {
  $my_args = array(
    'orderby'  => 'count',
    'order'    => 'DESC',
    'number'   => 15
  );
  $args = wp_parse_args( $args, $my_args );
return $args;
}
add_filter('widget_tag_cloud_args','set_widget_tag_cloud_args');

So it is restricting it to 15 tags correctly, but the orderby isn't working properly. For example, my most popular tags (by count) are "Piano" and "Bells" but these are not showing on the list at all. If I run the filter without the 'number' => 15 then the orderby count works properly, but then it shows 45 tags which is too much. Once I add the number arg back into the code it restricts it to 15, but its not displaying them in the right order.

Yellow shows tags across all limits, blue shows what tags are added upon increasing limit, red shows the top tags that don't appear under any limit, only default limit setting.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745427948a4627263.html

相关推荐

  • widgets - Sorting Tag Cloud by Popularity

    So I have the default Wordpress Tag Cloud Widget on my sidebarfooter and I found the following code to limit the number

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信