我在检查博客模板页面(在Wordpress中调用循环的页面)时遇到了问题。在设置中,我没有为主页和博客设置静态页面。我有一个为主页呈现的自定义模板。我希望能够检查博客模板,而不是博客单帖,主页或其他页面模板,因为我有其他自定义的东西在那里进行。
is_page_template() seems to affect other page templates.
is_home() calls my homepage
is_blog() calls my blog posts? 将非常感谢您的帮助!
发布于 2017-06-29 20:52:00
有趣的是。我认为你可以通过两种方式来检查
//BLOG CHECK
if( (is_archive() || is_author() || is_category() || is_home() || is_tag()) && (get_post_type() === 'post')):
//DO WHAT YOU WANT
endif;或
if(is_home() && !is_front_page()): // blog check
...
endif;希望它能帮你解决这个问题。
https://stackoverflow.com/questions/44825418
复制相似问题