Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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.