将如下代码放到主题的functions.php文件最下面即可

function colorCloud($text) { 
 $text = preg_replace_callback('|<a (.+?)>|i', 'colorCloudCallback', $text);
 return $text;
 } 
 function colorCloudCallback($matches) { 
 $text = $matches[1];
 $color = dechex(rand(0,16777215));
 $pattern = '/style=(\'|\")(.*)(\'|\")/i';
 $text = preg_replace($pattern, "style=\"color:#{$color};$2;\"", $text);
 return "<a $text>";
 } 
 add_filter('wp_tag_cloud', 'colorCloud', 1);
说点什么
支持Markdown语法
好耶,沙发还空着ヾ(≧▽≦*)o
Loading...