Is it possible to create a subcategory.php and use it to manage subcategories?

Or is there a way to get around this?

If it is not possible.. is there something like this?

<?php if(is_subcategory() || child() ) {
//do stuff
} else {
// do else
} ?>

I don't think it is possible to create a subcategory.php, but you can do the following in your category.php:

$category = get_category( get_query_var( 'cat' ) );

if( !empty( $category->parent ) ) { // the category has a parent, so it is a subcategory
    // do stuff
} else {
    // do else
  • hey sorich87...thank you very much.. i appreciate it greatly man.. keep up the good work..i wish u success – andrewk Sep 26 '10 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.