• Resolved roxer82

    (@roxer82)


    I need to add something at the posts, it should show that when you open a post. I was trying to do this:
    <?php if(($post)) {
    echo “This is a post page<br>”;
    } ?>

    But it shows it everywhere (at the index, category…). What should I do?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Cypher

    (@cypher)

    Try..

    if (is_page()) {
    echo "This is a post page";
    }

    Regards

    Thread Starter roxer82

    (@roxer82)

    Thanks for your answer Cypher but seems to not be working
    I should put it in index.php, right?

    moshu

    (@moshu)

    Try to re-phrase your initial question.
    Where exactly do you want to show “something”?
    On the main page?
    On a Page? – for this see Cypher’s code
    On a single post view?

    Thread Starter roxer82

    (@roxer82)

    I want to show it on a single post view

    moshu

    (@moshu)

    In that case you’ll need if is_single.
    Learn more here > Conditional_Tags.

    Thread Starter roxer82

    (@roxer82)

    Thanks Cypher and moshu 🙂
    it works now

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Add something at the posts’ is closed to new replies.