• <?php
     if ( is_category() ) {
    
    	$this_cat = get_category($cat);
    	$sub_cats = get_categories('child_of='.$this_cat->term_id.'&hide_empty=true&exclude=');
    
    	if ( !empty( $sub_cats ) ) {
    
    		foreach( $sub_cats as $sub ){
    
    			$link = get_category_link( $sub->term_id );
    			$link_title = $sub->name;
    
    			echo '<div class="post">';
    			echo '<h2><a href="'.$link.'" rel="bookmark" title="'.$link_title.'">'.$link_title.'</a></h2>';
    			echo $sub->description;
    			echo '</div>';
    		}
    	}
    }
    ?>
Viewing 1 replies (of 1 total)
  • Thread Starter arba

    (@arba)

    Solved it already in this way:

    <?php
     if ( is_category() ) {
    
    	$this_cat = get_category($cat);
            $sub_cats = get_categories('child_of='.$this_cat->term_id.'&hide_empty=false&orderby=name');
    
    	if ( !empty( $sub_cats ) ) {
    		foreach( $sub_cats as $sub ){			
    
            if ( $sub->category_parent == $this_cat->term_id) {
    
    			$link = get_category_link( $sub->term_id );
    			$link_title = $sub->name;
    
    			echo '<div class="post">';
    			echo '<h2><a href="'.$link.'" rel="bookmark" title="Permanent Link to '.$link_title.'">'.$link_title.'</a></h2>';
    
    			echo $sub->description;
    			echo '</div>';
                            }
    		}
    	}
    }
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘How can i exclude the subcats of subcat of cat from here:’ is closed to new replies.