WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is it possible to create a subcategory.php

and use it to manage subcats.

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
} ?>
share|improve this question
up vote 1 down vote accepted

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
share|improve this answer
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
you are welcome. thanks for the wishes! :D – sorich87 Sep 26 '10 at 22:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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