Return to Snippet

Revision: 10051
at December 4, 2008 21:34 by Ashung


Initial Code
<?php
function is_subcategory ($id) {
    $in_subcategory = false;
    foreach( explode( "/", get_category_children($id) ) as $child_category ) {
        if( in_category($child_category) ) {
            $in_subcategory = true;
        }
    }
    return $in_subcategory;
}
?>
<?php if ( is_category(1) || is_subcategory(1) ) { ?>
....LOOP....
<?php } ?>

Initial URL


Initial Description
wordpress in subcategory

Initial Title
wordpress in subcategory

Initial Tags
wordpress, category

Initial Language
PHP