Title: custom category list function
Last modified: August 19, 2016

---

# custom category list function

 *  Resolved [leebaz](https://wordpress.org/support/users/leebaz/)
 * (@leebaz)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/custom-category-list-function/)
 * Hi,
    I’ve recently ported [http://www.factorydesign.co.uk](http://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)

 *  [alieneila](https://wordpress.org/support/users/alieneila/)
 * (@alieneila)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/custom-category-list-function/#post-1473666)
 * 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](https://wordpress.org/support/users/leebaz/)
 * (@leebaz)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/custom-category-list-function/#post-1473849)
 * 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.

 * 2 replies
 * 2 participants
 * Last reply from: [leebaz](https://wordpress.org/support/users/leebaz/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/custom-category-list-function/#post-1473849)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
