Title: Functions.php help
Last modified: August 19, 2016

---

# Functions.php help

 *  [zygosgames](https://wordpress.org/support/users/zygosgames/)
 * (@zygosgames)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/functionsphp-help/)
 * Hey, recently installed slickpress here.
    [http://zygosgames.com/blog/](http://zygosgames.com/blog/)
 * Here’s the code I’m struggling with:
 *     ```
       # Displays a list of categories
       function dp_list_categories($exclude='') {
       	if (strlen($exclude)>0) $exclude = '&exclude=' . $exclude;
       	$categories = get_categories('hide_empty=1'.$exclude);
       	$first = true; $count = 0;
       	foreach ($categories as $category) {
       		$count++; if ($count>6) break;
       		if ($category->parent<1) {
       			if ($first) { $first = false; $f = ' class="f"'; } else { $f = ''; }
       			?><li<?php echo $f; ?>>
       			<a href="<?php echo get_category_link($category->cat_ID); ?>"><?php echo $category->name ?><?php echo $raquo; ?></a></li>
       			<?php
       		}
       ```
   
 * I want to make it so that the categories shown are predefined. At the moment 
   it’s simply selecting the first couple which are in A-Z order. Unfortunatley 
   this means it’s displaying categories which I don’t want it to, announcement,
   ds, feature, etc etc.
 * Can anyone help? I tried replacing it with a php navbar I coded but it didn’t
   work =S.
 * Many thanks in advance.

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

 *  Thread Starter [zygosgames](https://wordpress.org/support/users/zygosgames/)
 * (@zygosgames)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/functionsphp-help/#post-930168)
 * BUMP
 *  [seg](https://wordpress.org/support/users/seg/)
 * (@seg)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/functionsphp-help/#post-930623)
 * Did you get this to work?

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

The topic ‘Functions.php help’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [category](https://wordpress.org/support/topic-tag/category/)
 * [change](https://wordpress.org/support/topic-tag/change/)
 * [edit](https://wordpress.org/support/topic-tag/edit/)
 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [how-to](https://wordpress.org/support/topic-tag/how-to/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 2 replies
 * 2 participants
 * Last reply from: [seg](https://wordpress.org/support/users/seg/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/functionsphp-help/#post-930623)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
