Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter lucasbceo

    (@lucasbceo)

    Hey Maeve!

    That’s odd, isn’t it?

    I have deleted everything and started from scratch.

    Debugging now, seems that the plugin displays the categories in the order they are added, and doesn’t take into consideration that it has a parent or not.

    If I add “Category1” first, then “Category2” as subcategory, it will display:

    Category2
    Category1

    You understand?
    Have something in mind I can try here, regarding the code?

    // generating sidebar
    		if($count>0){
    			$return_string .= '<li class="wpc-category ' . $class . '"><a href="'. get_option('catalogue_page_url') .'">Todos os Produtos</a></li>';
           		foreach($termsCatSort as $term){
    				//sub category class
    				 if($term->parent > 0){
    					$class2	= ' sub-cat';
    					}else{
    					$class2	= ' main-cat';
    					}
    				if($term_slug==$term->slug){
    				$class	=	'active-wpc-cat';
    			}else{
    				$class	=	'';
    			}
    			$return_string .=  '<li class="wpc-category '. $class .''. $class2 .'"><a href="'.get_term_link($term->slug, 'categoria').'">'. $term->name .'</a></li>';
    			}
    		}else{
    			$return_string .=  '<li class="wpc-category"><a href="#">Nenhuma Categoria</a></li>';
    		}
Viewing 1 replies (of 1 total)