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

问题描述 投票:0回答:2

我这样写在functions.php中的函数

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

add_filter('the_content','out');

而且我希望在文章内容之后,在帖子的末尾获取它。但它所做的只是未显示帖子条目(the_content输出的内容),而我仅收到“帖子结尾,谢谢阅读”。

我在做什么错?

php wordpress wordpress-plugin
2个回答
1
投票

尝试一下:

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

1
投票

您可以尝试这个吗?>

function out($content) {
  $content .= '<br>End of the post, thanks for reading';
  return $content;
}

add_filter('the_content','out');
© www.soinside.com 2019 - 2024. All rights reserved.