|
魔扣币兑换比例:【 50以下 : ¥1 = 10 魔扣币 】丨【 50 - 100 :¥1 = 20 魔扣币】丨【 100以上:¥1 = 30 魔扣币 】
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
有时候我们需要替换文章的某些文字为其它文字,比如给特定的文字加上链接,利用 SEO 和用户体验。
下边的代码即可实现这种功能:
/**
*WordPress 替换文章的某些文字
*http://www.morko.net/
*/
function Bing_content_str_replace($text){
$replace_words = array(
//添加要替换的文本,格式:'要替换的' => '替换到的内容'
'morko' => '<a href="http://www.morko.net">morko.net</a>',
'魔扣科技' => '<a href="http://www.morko.net">魔扣科技</a>',
'functions.php' => '<a href="http://bbs.morko.net/forum-wordpress-1.html">functions.php</a>'
);
return str_replace( array_keys( $replace_words ), $replace_words, $text );
}
add_filter( 'the_content', 'Bing_content_str_replace' );
add_filter( 'the_excerpt', 'Bing_content_str_replace' );
|
|