在functions.php[Wordpress]中添加函数时出现问题
我像这样在functions.php中编写函数在functions.php[Wordpress]中添加函数时出现问题,php,wordpress,Php,Wordpress,我像这样在functions.php中编写函数 function out() { $s = 'End of the post, thanks for reading'; return $s; } add_filter('the_content','out'); 我希望这篇文章在文章的结尾,在输入内容之后会被提取出来。但它所做的只是没有显示帖子条目(内容输出),我只得到“文章结束,感谢阅读” 我做错了什么?试试这个: function out($content) { return
function out() {
$s = 'End of the post, thanks for reading';
return $s;
}
add_filter('the_content','out');
我希望这篇文章在文章的结尾,在输入内容之后会被提取出来。但它所做的只是没有显示帖子条目(内容输出),我只得到“文章结束,感谢阅读”
我做错了什么?试试这个:
function out($content) {
return $content . ' End of the post, thanks for reading';
}
add_filter( 'the_content', 'out' );
你能试试这个吗
function out($content) {
$content .= '<br>End of the post, thanks for reading';
return $content;
}
add_filter('the_content','out');
功能输出($content){
$content.='
文章结束,谢谢阅读';
返回$content;
}
添加_过滤器('the_content','out');
谢谢,伙计,这很管用。所以我每次都需要把参数传递给函数?然后返回相同的参数?请查看此页面: