Forums

[resolved] Add something at the posts (7 posts)

  1. roxer82
    Member
    Posted 3 years ago #

    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?

  2. Cypher
    Member
    Posted 3 years ago #

    Try..

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

    Regards

  3. roxer82
    Member
    Posted 3 years ago #

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

  4. moshu
    Member
    Posted 3 years ago #

    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?

  5. roxer82
    Member
    Posted 3 years ago #

    I want to show it on a single post view

  6. moshu
    Member
    Posted 3 years ago #

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

  7. roxer82
    Member
    Posted 3 years ago #

    Thanks Cypher and moshu :)
    it works now

Topic Closed

This topic has been closed to new replies.

About this Topic