How to make things only appear on posts? (3 posts)

  1. klippert
    Posted 3 years ago #

    Hi, I am trying to figure out how to make things only appear on my posts and not my homepage. I use an index.html template for both the homepage and my posts. I have this code <?php if(is_home() && $post==$posts[0] && !is_paged()) { ?> to make some stuff appear just on my homepage, but i would like to know if there is an opposite to that that makes things only appear on posts.

  2. catacaustic
    very awesome
    Posted 3 years ago #

    If you want it so that it's not showing on the home page:

    if (!is_home() && !is_front_page()) {
        // Your code in here

    is_home() and is_front_page() are slightly different, but you should use both of them to check properly.

    Another thing that you can do is use an if/else statement with what you have now:

    if(is_home() && $post==$posts[0] && !is_paged()) {
        // Post page
    else {
        // Home page!
  3. Michael
    Forum Moderator
    Posted 3 years ago #

    is_single() would detect single posts;


Topic Closed

This topic has been closed to new replies.

About this Topic