wordpress添加内置锚文本功能
模版文件function中添加
function replace_text_wps($text){
$replace = array(
'字段1' => '<a href="http://url.com/" rel="bookmark" title="标题说明">字段</a>',
'字段2' => '<a href="http://url.com/" rel="bookmark" title="标题说明">字段2</a>',
'关键词' => '<a href="http://url.com/" rel="bookmark" title="说明">关键词</a>'
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'replace_text_wps');