有没有从wordpress标签云标签中移除内联样式的好方法?我想为所有的标签设置相同的大小,如果我可以的话根本不想要内联样式。
谢谢
发布于 2012-07-18 02:20:33
您可以使用WordPress的核心过滤器来修改不同函数的输出。wp_generate_tag_cloud()有一个允许您编辑字符串输入的过滤器。
add_filter('wp_generate_tag_cloud', 'xf_tag_cloud',10,3);
function xf_tag_cloud($tag_string){
return preg_replace("/style='font-size:.+pt;'/", '', $tag_string);
}发布于 2017-11-17 19:04:30
不幸的是,Rezens regexp在我的例子中不起作用。您可以使用以下过滤器和regexp删除输出上的整个inline style标记:
add_filter('wp_generate_tag_cloud', 'myprefix_tag_cloud',10,1);
function myprefix_tag_cloud($tag_string){
return preg_replace('/style=("|\')(.*?)("|\')/','',$tag_string);
}发布于 2011-05-27 06:43:16
https://stackoverflow.com/questions/6138227
复制相似问题