简体   繁体   English

WordPress:is_home()和is_front_page()有问题

[英]Wordpress: Having issues with is_home() and is_front_page()

I have this snippet in a "portfolio-loop.php" file. 我在“ portfolio-loop.php”文件中有此代码段。 I'm using get_template_part to display the loop on the front page and on other pages. 我正在使用get_template_part在首页和其他页面上显示循环。

I have this within the loop: 我在循环中有这个:

<?php if( !is_home() || !is_front_page() ) : ?>
  <p><?php the_time('F Y'); ?></p>
<?php endif; ?>

I can't seem to get it to exclude the front page. 我似乎无法将其排除在首页之外。 Could it because it's in it's own template? 是否因为它在自己的模板中?

you probably mean 你可能是说

if( !is_home() && !is_front_page() )

Meaning you are not home AND you are not on the front page 表示您不在家并且不在首页上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM