Support » Fixing WordPress » How to make things only appear on posts?

  • 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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!
    }
    Michael

    (@alchymyth)

    Forum Moderator

    is_single() would detect single posts;

    http://codex.wordpress.org/Conditional_Tags

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to make things only appear on posts?’ is closed to new replies.