我使用的是:
add_action('the_content' , 'statistics_page');
在函数'statistics_page'中,我输入:
if(is_page(25)) { //blabla }
这完全适用于我想要它显示在(25)的页面,但所有其他页面都有他们的内容剥离,他们不显示任何内容。
我该如何解决这个问题?
EDIT: extra info
网站链接:http://pauldekoning.com/wot
你会看到主页没有显示文本,论坛页面也没有论坛。
the_content
是一个过滤器,所以您应该使用apply_filter
而不是add_action
,并且您必须确保从函数返回实际内容。在将代码更新为以下内容后尝试。
apply_filters('the_content' , 'statistics_page');
function statistics_page($content){
if( is_page(25) ) {
//blabla
}
return $content;
}