- Date: Jan 5,2008
- 2 Comments
- In: Tutorials, Wordpress
If Conditional tags for Wordpress themes
One year ago, I had some ”problems” with a wordpress theme because I wanted a simple thingy and I didn’t know how to do it: make certain stuff (ads, categories, widgets) to appear or disappear depending on the type of page I wanted to add them. This trick is good for placing, rotating ads especially in the header, sidebar and footer, based on conditional tags that are built in wordpress.
The first conditional tag that describes your index or home page is: is_home(). I will write you an example shortly but now I let me explain why you should use this. Let’s say you have an ad spot of 728×90px in your header or footer and in that spot you want a certain banner to appear when you are browsing the index page and another banner when you are reading a post or viewing a category page. For this you can place the following php cod in that spot:
