演示


教程
外观-主题文件编辑器
以下代码放到functions.php里面

//WordPress圆角彩色背景标签云
function colorCloud($text) {
$text = preg_replace_callback('|<a (.+?)>|i', 'colorCloudCallback', $text);
return $text;
}
function colorCloudCallback($matches) {
$text = $matches[1];
$colors = array('F99','C9C','F96','6CC','6C9','37A7FF','B0D686','E6CC6E');
$color=$colors[dechex(rand(0,7))];
$pattern = '/style=(\'|\")(.*)(\'|\")/i';
$text = preg_replace($pattern, "style=\"display: inline-block; *display: inline; *zoom: 1; color: #fff; padding: 1px 5px; margin: 0 5px 5px 0; background-color: #{$color}; border-radius: 3px; -webkit-transition: background-color .4s linear; -moz-transition: background-color .4s linear; transition: background-color .4s linear;\"", $text);
$pattern = '/style=(\'|\")(.*)(\'|\")/i';
return "<a $text>";
}
add_filter('wp_tag_cloud', 'colorCloud', 1);
@版权声明:
文章版权归作者所有,未经允许请勿转载,如需转载请附带原文链接 谢谢。
本博客所有文章除特别声明外,均默认采用CC BY-NC-SA 4.0 许可协议
本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
如有侵权 联系邮箱2131456789@qq.com
文章版权归作者所有,未经允许请勿转载,如需转载请附带原文链接 谢谢。
本博客所有文章除特别声明外,均默认采用CC BY-NC-SA 4.0 许可协议
本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
如有侵权 联系邮箱2131456789@qq.com