php – wordpress is_home()|| is_index()可能吗?
发布时间:2020-12-13 18:27:14 所属栏目:PHP教程 来源:网络整理
导读:我在我的header.php中有一个测试,看看我们是否在家里展示英雄. ?php if ( is_home() have_posts() ) : ? div id="hero" class="inner clearfix" ... /div?php endif ? 但是当用户登陆index.php时,英雄没有被显示. 显然没有is_index()条件,有没有人知道如何测
我在我的header.php中有一个测试,看看我们是否在家里展示英雄.
<?php if ( is_home() && have_posts() ) : ?> <div id="hero" class="inner clearfix"> ... </div> <?php endif ?> 但是当用户登陆index.php时,英雄没有被显示.
试试is_front_page()
<?php if ( is_home() || is_front_page() ) : ?> <div id="hero" class="inner clearfix"> ... </div> <?php endif ?> 如果你是站点的绝对根,那应该返回true. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |