如果你在博客的文章中经常加入一些关键词句,但后来准备将这些关键词句替换为其它的内容,手动替换工作量大、而且麻烦。下面的段代码可以非常方便地帮你替换掉这些关键词句。
将下面代码加到主题的functions.php文件中:
- replace_text_wps(){
- = (
- \’wordpress\’ => \'<a href=>wordpress</a>\’,
- \’excerpt\’ => \'<a href=>excerpt</a>\’,
- \’\’ => \'<a href=></a>\’
- );
- = ((), , );
- ;
- }
- add_filter(\’the_content\’, \’replace_text_wps\’);
- add_filter(\’the_excerpt\’, \’replace_text_wps\’);
原文:How to easily replace words in your posts
暂无评论内容