Top

nextlimits on "Is subcategory of a given category"

July 25, 2010 by  

Hi guys,

Here is the situation. I have a site composed of pages and posts and different categories.
I want to show in the sidebar, a custom menu based on the new menu from WP 3.0.

I am already showing it on all child pages of any given page (is_tree) but I would also want to be able to show it on categories that are added in the custom menu.

<?php
	// A second sidebar for widgets, just because.
	if ( is_tree('8') ) : if ( is_active_sidebar( 'projects' ) ) : ?>

So what I’m looking for is a function that will return true or false, if it is a subcategory of a defined category. Something that will end up like this:

<?php
	// A second sidebar for widgets, just because.
	if ( is_tree('8') || is_subcategory('7') ) : if ( is_active_sidebar( 'projects' ) ) : ?>

Thanks

Be Sociable, Share!
Share

Comments

Facebook comments:

One Response to “nextlimits on "Is subcategory of a given category"”

  1. Tony on August 17th, 2010 11:26 am

    Google helps:
    http://wordpress.org/support/topic/creating-an-is_subcategory-conditional-function#post-1317911

    PS:
    Two captchas for submitting comments? Overkill?

Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!





*
Bottom