wordpress 模板代码,替换文章内容的代码

在 

functions.php

文件最下面,加上这一句。


 function replace_text_xintheme($text){

    $replace = array(

        //'关键词' => '将要替换的关键词'

        'hsmw-999' => 'hsmw-666',

    );

    $text = str_replace(array_keys($replace), $replace, $text);

    return $text;

}

add_filter('the_content', 'replace_text_xintheme');

add_filter('the_excerpt', 'replace_text_xintheme');

没有评论:

发表评论

Follow Us

FOLLOW US

Blog Archive

Comments

Blogger 提供支持.

Search This Blog

Tags

header ads