Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在functions.php[Wordpress]中添加函数时出现问题_Php_Wordpress - Fatal编程技术网

在functions.php[Wordpress]中添加函数时出现问题

在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

我像这样在functions.php中编写函数

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');
谢谢,伙计,这很管用。所以我每次都需要把参数传递给函数?然后返回相同的参数?请查看此页面: