0
我试图让下面的代码工作:WordPress的 - 为什么我不能在插件内使用条件标签?
if(is_home()):
echo 'User is on the homepage.';
else:
echo 'User is not on the homepage';
endif;
如果我把它放在主题页眉或页脚,然后它工作,但如果我把它放在我的插件,这是行不通的。我也尝试过is_single()
和is_page()
,并且它们在插件内部不起作用。任何想法是什么问题?