• Hi

    I have a test site set up here:
    https://stargate-brats.net/labtest/

    and I am trying to get a list of categories in my sidebar. But everytime I put the code in I get “no categories” when there are categories! I have about 10 categories in the admin panel. 6 are top level, and 4 are sub-categories. I’ve made three test posts in three seperate categories to try and get something to show up.

    this code:

    <?php wp_list_cats('sort_column=name&optioncount=1'); ?>

    displays a list, but only of cats that are not empty. I want to display all top level categories.

    so, I looked up the code and I tried it and it didnt work. So I tried each of these in an attempt to just get -anything- to show up:


    <?php wp_list_cats('children=1&sort_column=name'); ?>
    <?php wp_list_cats('sort_column=name&hid?- e_empty=0'); ?>
    <?php list_cats(0, 'All', 'name'); ?>
    <?php list_cats(0,'','name','','',true,0,1,1,1); ?>
    <?php wp_list_cats('all'); ?>
    <?php list_cats(); ?>

    <form action="<?php echo $PHP_SELF ?>" method="get">
    <?php dropdown_cats(); ?>
    <input type="submit" name="submit" value="view" />
    </form>

    and none of them work. the dropdown one has 5 cats, but they seem to be random ones. the others all say “no categories” and you can see that on my site. In the menu, the cats that are displayed ok, are the ones from the first code, that works.. but all the others are the ones saying “no categories” (I left each peice of code in, and tried them seperatly and it didnt work either way. Ive left them all in now so you can see that none of them are working)

    so can anyone tell me what I am doing wrong?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Customizing Your Sidebar has some good examples you can copy from that might help, and it looks like you already found wp_list_cats() and list_cats() with their good examples, and you’ve posted posts under the categories you want to appear, so it’s a matter of narrowing down the little details. You’ve, I assume, done a total clearing of your browser’s cache to make sure you see the changes…..

    Thread Starter bratty

    (@bratty)

    yeah that site is where I found some of the codes.. but Im unclear how I can narrow it down. shouldnt just using the “php wp_list_cats(‘all’);” one display something at least?

    and yeah, Ive cleared the cache. I’ve tried refreshing, I’ve tried a different browser. I’ve tried taking them out, putting them back in. still not working. ??

    There is no “all” in wp_list_cats() ;-).

    <ul>
    <?php wp_list_cats('sort_column=name&hide_empty=0&
    children=1&exclude=10, 15'); ?>
    </ul>

    This works. It sorts by name, it shows every category including empty ones and the children categories, and excludes category IDs 10 and 15, as an example. Copy and paste it, and delete the line break between & and children= so it is all on one line with no spaces, and it should work.

    Thread Starter bratty

    (@bratty)

    thanks! that works. its just confusing to fiigure out how to put the code in, I saw the “all” in an example peice of code, and it didnt say to take it out..

    thanks for that ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Category list – says No Categories’ is closed to new replies.