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?
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?
Try..
if (is_page()) {
echo "This is a post page";
}
Regards
Thanks for your answer Cypher but seems to not be working
I should put it in index.php, right?
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?
I want to show it on a single post view
In that case you'll need if is_single.
Learn more here > Conditional_Tags.
Thanks Cypher and moshu :)
it works now
This topic has been closed to new replies.