want to create a subcategory.php to manage subcats

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

Or is there a way to get around this?

Read More

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

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

Related posts

Leave a Reply

1 comment

  1. 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
    }