I want to dynamically change some of what shows in my sidebar whether I am on the homepage, one of my 3 main categories or all all other pages. I tried to use is_home() like the following but it doesn't work.
if (is_home()) { /* home */
...
} elseif ( in_category(3) ) { /* a post from cat 3 */
...
} elseif ( in_category(4) ) { /* a post from cat 4 */
...
} elseif ( in_category(5) ) { /* a post from cat 5 */
...
} else { /* generic pages like about us */
...
}
I am not doing anything special in index.php other than to limit the number of post returned with query_posts("showposts=1"); so I am not sure why it is not working.
I tried used is_front_page() instead of is_home() but that didn't help me at all either. I even tried to echo what is_home() and is_front_page() and I don't even get false returned [no value is return].
I know I could have a special siderbar for the home page with say get_sidebar('home'); but since only part of the sidebar is different that doesn't seem like the right solution.
Help?
Thanks,
staiano