【问题标题】:change background-color of tags inside tag cloud based on the number of times it is used根据使用次数更改标签云内标签的背景颜色
【发布时间】:2012-12-24 14:40:37
【问题描述】:

有没有一种方法可以根据标签的使用次数为 wordpress 中tag cloud 中的标签设置不同的background-color

示例:使用较多的标签会以较深的颜色显示

使用较少的标签会以较浅的颜色显示

我知道font-size 可以更改为

add_filter('widget_tag_cloud_args','set_cloud_tag_size');
    function set_cloud_tag_size($args) {
      $args = array('smallest'    => 14, 'largest'    => 20);
      return $args;
    }

如何为标签的background-color 实现类似的行为。

【问题讨论】:

    标签: tags wordpress


    【解决方案1】:

    wp_tag_cloud()TAG CLOUD 小部件的内置 wordpress 方法,它接受字体大小数组。您需要在您的主题中编写一个自定义方法来处理更改background-color 而不是font-size

    编写此方法应该非常简单,并且与上述方法类似。您很可能会在wp-includes/widgets.php 中找到代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-20
      • 1970-01-01
      • 2012-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多