WordPress.org

Forums

Functions.php help (3 posts)

  1. zygosgames
    Member
    Posted 6 years ago #

    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.

  2. zygosgames
    Member
    Posted 6 years ago #

    BUMP

  3. seg
    Member
    Posted 6 years ago #

    Did you get this to work?

Topic Closed

This topic has been closed to new replies.

About this Topic