WordPress.org

Support

Support » Themes and Templates » Functions.php help

Functions.php help

  • zygosgames
    Member

    @zygosgames

    Hey, recently installed slickpress here.
    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)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Functions.php help’ is closed to new replies.