开发WordPress时怎么用短代码中过滤掉br标签呢

2022年07月27日 • 阅读 2043
WordPress 短代码中过滤掉br标签function add_style( $atts, $content = null ) 

WordPress 短代码中过滤掉br标签

function add_style( $atts, $content = null ) {
    $pure_content = str_replace("<br />","",$content);
    return '<style>' . $pure_content . '</style>';
}
add_shortcode( 'style', 'add_style' );


按照上方代码操作,在执行 add_shortcode 即可

本文由青舟模板网发布,如若转载,请注明出处:http://qingzo.com/jishu/1658890997.html
评论列表

共有0条评论来说两句吧...

欢迎 发表评论: