Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Dumai

    (@dumai)

    Just another try to get help on this. I’m willing to pay as well to get this issue resolved.

    Thanks!

    Thread Starter Dumai

    (@dumai)

    Anyone willing to give a hand with this code? or if someone can help guide this issue in the right forum.

    Cheers!

    <?php
    if(is_category()) {
    
    	$breakpoint = 0;
    	$thiscat = get_term( get_query_var('cat') , 'category' );
    	$subcategories = get_terms( 'category' , 'parent='.get_query_var('cat') );
    
    	if(empty($subcategories) && $thiscat->parent != 0) {
    		$subcategories = get_terms( 'category' , 'parent='.$thiscat->parent.'' );
    	}
    
    	$items='';
    	if(!empty($subcategories)) {
    		foreach($subcategories as $subcat) {
    			if($thiscat->term_id == $subcat->term_id) $current = ' current-cat'; else $current = '';
    			$items .= '
    			<li class="cat-item cat-item-'.$subcat->term_id.$current.'">
    				<a href="'.get_category_link( $subcat->term_id ).'" title="'.$subcat->description.'">'.$subcat->name.'</a>
    			</li>';
    		}
    		echo "<ul class='links'>$items</ul>";
    	}
    	unset($subcategories,$subcat,$thiscat,$items);
    }
    ?>

    The code above pulls the Child Category links of the Parent category, but it only works on archive pages (Parent/Child Category). Can someone please help to also make it work when you go into a post (single.php).

Viewing 3 replies - 1 through 3 (of 3 total)