Reputation: 1828
I have this small snippet to check if
But it always shows me "no breadcrumb".
<?php if ( !has_post_thumbnail( $post->ID ) OR !is_front_page() OR !is_home() ) : ?>
<p>no breadcrumb</p>
<?php endif; ?>
I think there is a trivial error and i am just too blind to see it?
Upvotes: 0
Views: 9039
Reputation: 6412
Your markup probably should be (if it doesn't have a thumbnail and is not home or frontpage):
<?php if ( !has_post_thumbnail( $post->ID ) && !is_front_page() || !is_home() ) { ?>
<p>no breadcrumb</p>
<?php } ?>
This is equates to "if it doesn't have a post thumbnail and isn't the front page or home page".
Upvotes: 0
Reputation: 761
Consider that you are on home page. What your condition will check if !has_post_thumbnail( $post->ID )
, means there is no post thumbnail. So it will show <p>no breadcrumb</p>
.
Now consider you are on some other page and not home page. What your condition will check is if !is_front_page()
or !is_home()
. So will again show <p>no breadcrumb</p>
.
P.S. why don't you use ||
operator instead of OR
.
Upvotes: 1