WordPress.org

Ready to get started?Download WordPress

Forums

list_cats and wp_list_cats help (1 post)

  1. pramclub
    Member
    Posted 7 years ago #

    I'm running WP 2.0.7, and using the Sharepointlike template:
    http://www.freesitebuilder.co.uk/WordPress/

    I've been struggling with the Category list - I've been looking at Fold Categories plugin, but as it's based on wp_list_cats, I thought I'd better practise with that first! I've read up in the codex, and there's a lot of posts here, but I don't seem to be able to make it do what I want.

    At the moment, some of my categories have sub-categories, and they're sorted alphabetically regardless of heirachy. I'd like to have sub-cats show under their parent category.

    The original code looks like this:
    <?php wp_list_pages(); ?>
    <li><?php _e('Categories'); ?>
    <ul><?php list_cats(FALSE, ' ', 'name') ?>
    </ul>

    I started by replacing list_cats with wp_list_cats, as I find boolean easier than string, with this line:
    <?php wp_list_cats('sort_column=id&optioncount=1'); ?>

    but at the moment the count goes to another line, so I set that to 0 for now (I assume I need to correct the CSS when I've sorted this out). Using wp_list_cats with the defaults seems to give me a random order, rather than heirachical or alpha.

    TIA

Topic Closed

This topic has been closed to new replies.

About this Topic