0

I am setting up a blog with a static front page (name: Front Page, slug: front-page) and the blog on a page named "Blog" with the slug "blog".

What I want to do is have my site title be inside and h1 element when the page is post listing such as /blog, but then be inside and h6 element when it it is a page, single post, etc.

Right now my condition looks as follows:

<?php if ( is_page( 'blog' ) ) : ?>
    <h1>POST LISTING</h1>
<?php else : ?>
    <h1>NOT POST LISTING</h1>
<?php endif; ?>

When I pull the sit up, everything displays the NOT POST LISTING text, even /blog.

What am I missing?

1 Answer 1

1

is_home is the check you need to use if the page is set to be the blog page in settings > reading

<?php
if(is_home()) {
 // do something
} else {
 // do something
}
?>
1
  • Thank you. I figured it was something simple. In my head I was confusing is_home() for is_front_page().
    – Cedon
    Commented Jun 4, 2016 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.