I'm trying to target my landing page with is_front_page
or is_home
in my page.php
file but it's not working. I have set the settings > reading
to a static page.
However, if I create a page-home.php
everything works fine (without the tags of course). But, if I use the is_front_page
or is_home
on the index file they will work (on my blog page).
Am I just misunderstanding their function and if so, how can I target the landing page dynamically?
<?php get_header(); ?>
<?php if ( is_front_page() || is_home() ) : ?>
<h1>Why not???</h1>
<?php endif; ?>
<div>
<article>
<?php get_template_part( 'loop', 'page' ); ?>
</article>
<aside>
<?php get_sidebar(); ?>
</aside>
</div>
<?php comments_template(); ?>
<?php get_footer(); ?>