• Resolved leebaz

    (@leebaz)


    Hi,
    I’ve recently ported https://www.factorydesign.co.uk to WordPress, and it’s working great! However, we have a list of clients on the RHS, which is generated from the sub-category of teh ‘clients’ category.

    Ideally I want to show empty clients, but NOT as links. I know that if I change hide_empty=1 to 0 then the empty post appear in the links, however, how can I disable the link, or make it a # for example?

    Many thanks
    Lee

Viewing 2 replies - 1 through 2 (of 2 total)
  • You’ll have to do something like child_of=#&hide_empty or parent=#&hide_empty for the args, # being the main category they are listed under, but this should work…

    $categories = get_categories('hide_empty=0');
    
    	foreach ($categories as $cat) {
    		if ($cat->count) {
    			echo '<a href="?cat=' . $cat->term_id . '">' . $cat->cat_name . '</a><br />';
    		}
    		else {
    			echo $cat->cat_name . '<br />';
    		}
    	}

    Thread Starter leebaz

    (@leebaz)

    Awesome! Thank you so much, I was able to take that and tweak it to meet my needs!

    Lee

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom category list function’ is closed to new replies.