在functions.php [Wordpress]中添加函数的问题


Issue with adding function in functions.php [Wordpress]

我在functions.php中这样写函数

function out() {
  $s = 'End of the post, thanks for reading';
  return $s;
}
add_filter('the_content','out');

,我希望在文章的末尾,在条目内容之后获取它。但它所做的只是帖子条目(the_content输出)没有显示,我只得到"帖子结束,感谢阅读"。

我做错了什么?

试试这个:

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');