Site logo

Archived topic

Hooks Issue with conditional tags

11 replies · Started by Manuel on April 15, 2018

Viewing posts 1–12 of 12

Hi,

I´m trying to do the following.

I have a template header only for homepage and a template header for the rest of the pages and my conditional tags work fine as follows:

<?php if ( is_front_page() ) : ?>
[elementor-template id="17"]
<?php endif; ?>
<?php if ( ! is_front_page() ) : ?>
[elementor-template id="125"]
<?php endif; ?>

Now I have a specific Landing Page and I don´t want to display on that page none of those templates, I have tried with this Tag:
<?php if ( ! is_page( 7400) ) : ?>
[elementor-template id="125"]
<?php endif; ?>

but it doesn't work as it displays twice the template.

Thanks for your help.

Hi there,

I believe this is what you are after:

<?php if ( ! is_front_page() || ! is_page( 7400) ) : ?>
    [elementor-template id=”125″]
<?php endif; ?>

Let me know.

No,

the secondary header still appears. This are my hooks now:

<?php if ( is_front_page() ) : ?>
[elementor-template id="17"]
<?php endif; ?>
<?php if ( ! is_front_page() ) : ?>
[elementor-template id="125"]
<?php endif; ?>
<?php if ( ! is_front_page() || ! is_page( 7400 ) ) : ?>
[elementor-template id=”125″]
<?php endif; ?>

This should be your overall code:

<?php if ( is_front_page() ) : ?>
    [elementor-template id="17"]
<?php endif; ?>
<?php if ( ! is_front_page() && ! is_page( 125 ) ) : ?>
    [elementor-template id="125"]
<?php endif; ?>

Sorry, but still doesn't work, nothing changed.

Hmm I just tested and it should work.

Can you link me to the page that isn't working?

Hi, yes I tried also with the ID Number but the result was the same.

Just to make sure, this is your overall snippet?

<?php if ( is_front_page() ) : ?>
    [elementor-template id="17"]
<?php endif; ?>
<?php if ( ! is_front_page() && ! is_page( 7400 ) ) : ?>
    [elementor-template id="125"]
<?php endif; ?>

And execute PHP is checked?

Now is working ok. Thanks a lot.

No problem!

This archived topic is closed to new replies.