In a previous post (Don’t show this if the url contains the following) I asked how I would go about having my header echo a div if the user loaded a URL with /blog in the header.
What I didn’t take into consideration, was that I don’t want the div to display if its not just got /blog in the url, but if its any blog post, not just the index page of the blogs.
How do I run a bit of code from my header.php if the page I’m looking at is a blog post?
You would use the WordPress functions is_single() and is_page.
For only posts, only use is_single, the same for page, home, and archive.
The full listing of is_statements can be found here. Here are some others:
It’s been long since I’ve played with wordpress but you can achieve a lot with using the conditional tags:
http://codex.wordpress.org/Conditional_Tags
Seems like is_single() might do what you want. Eg: