please add an OR for the "contact" page here: if ( !isfrontpage() ) {…
- User
please add an OR for the "contact" page here:
if ( !is_front_page() ) { get_template_part('template-parts/common/common', 'community'); }
- Assistant
Certainly! To include an OR condition for the "contact" page, you can modify the
ifstatement like this:if ( !is_front_page() || is_page('contact') ) { get_template_part('template-parts/common/common', 'community'); }This condition will be true if the current page is not the front page OR if it is the "contact" page.
If you want the template part to load only on pages that are either not the front page or specifically the "contact" page, this is correct.
If instead you want it to load on pages that are not the front page and also the contact page (which is logically impossible since the front page and contact page are different), then you'd use
&&instead of||.Let me know if you want the condition differently!
- User
the condition is: it's not the front page or it's not the contact page
- Assistant
Got it! You want the condition:
"It's not the front page OR it's not the contact page."
In PHP terms:
if ( !is_front_page() || !is_page('contact') ) { get_template_part('template-parts/common/common', 'community'); }However, note that this condition will almost always be true because a page cannot simultaneously be both the front page and the contact page — so at least one part of the
||will always be true.If you want the template part to load on all pages except when the page is BOTH the front page AND the contact page, that's one thing, but since they're different pages, it will always load.
Double-check if you instead meant:
- NOT (front page OR contact page) (i.e., neither front page nor contact page), which would be:
if ( !is_front_page() && !is_page('contact') ) { get_template_part('template-parts/common/common', 'community'); }That will load the template part only on pages that are neither the front page nor the contact page.
Please confirm what behavior you want!