简体   繁体   中英

Wordpress: Having issues with is_home() and is_front_page()

I have this snippet in a "portfolio-loop.php" file. I'm using get_template_part to display the loop on the front page and on other pages.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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