WordPress

推荐列表 站点导航

当前位置:首页 > 建站教程 > WordPress >

WordPress教程:替换文章的某些文字

来源:网络整理  作者:  发布时间:2020-12-14 13:32
有时候我们需要替换文章的某些文字为其它文字,比如给特定的文字加上链接,利用 SEO 和用户体验。 下边的代码即...

    );

        //添加要替换的文本,格式:'要替换的' => '替换到的内容'

    *WordPress 替换文章的某些文字

add_filter( 'the_content', 'Bing_content_str_replace' );

        'functions.php' => '<a href="">functions.php</a>'

    *

add_filter( 'the_excerpt', 'Bing_content_str_replace' );

*/

        'adminbuy' => '<a href="">ym97.com</a>',

    return str_replace( array_keys( $replace_words ), $replace_words, $text );

}

        '魔客吧' => '<a href="">AB模版网</a>',

    $replace_words = array(

下边的代码即可实现这种功能:

function Bing_content_str_replace($text){

有时候我们需要替换文章的某些文字为其它文字,比如给特定的文字加上链接,利用 SEO 和用户体验。

/**

相关热词: 教程

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jz/wp/3787.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

WordPress教程:替换文章的某些文字

2020-12-14 编辑:

    );

        //添加要替换的文本,格式:'要替换的' => '替换到的内容'

    *WordPress 替换文章的某些文字

add_filter( 'the_content', 'Bing_content_str_replace' );

        'functions.php' => '<a href="">functions.php</a>'

    *

add_filter( 'the_excerpt', 'Bing_content_str_replace' );

*/

        'adminbuy' => '<a href="">ym97.com</a>',

    return str_replace( array_keys( $replace_words ), $replace_words, $text );

}

        '魔客吧' => '<a href="">AB模版网</a>',

    $replace_words = array(

下边的代码即可实现这种功能:

function Bing_content_str_replace($text){

有时候我们需要替换文章的某些文字为其它文字,比如给特定的文字加上链接,利用 SEO 和用户体验。

/**

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jz/wp/3787.shtml

相关文章

风云图片

推荐阅读

返回WordPress频道首页