• I feel silly asking this, but I’ve searched and searched and cant find out how to do this…

    what I want to do, is have my top level categories listed in the sidebar (which I know how to do now), but then what I want is to have the page that loads when you click one, display a list of the sub categories instead of the list of posts for that category. So display the sub cats in the content area instead of the sidebar.

    I’ve figured out how to get a list of -all- categories to display in the contact area, but not the sub categories of the link that was clicked.

    So… I guess what I need to know, is do I need to make a new template for each category and then use the code to display the child categories of that category? (which would be a pain, because I’d have to make a new template each time I added a top level category) or is there a general code I can use just within the category template that will display the child cats of whatever one was clicked?

    or is there a plug in that might do it?

    thanks for any help you can give..

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter bratty

    (@bratty)

    thanks, I looked through all the Thread title matches, and the recent posts.. and then just for fun looked at the relevant posts too, but had no luck. there were people asking the same thing as me, but no one really had a solution. The one post that did, the person asking said it didnt work….

    The one post that did, the person asking said it didnt work….

    Yeah, that’s the solution I recommended and still recommend. Have you tried it? It should work and works for me. At least give it a shot.

    Thread Starter bratty

    (@bratty)

    yeah I went and tried it anway, and it did work. I was just hoping there would be something I could do, that didnt involve making a new template for each category that I wanted to list the sub-cats for. But it will do in the meantime until I can figure something else out, or whatever. thanks for the help ??

    Just for future reference for anyone that happens to stumble across this post in the future, what I did was:

    I created category templates called category-1.php etc for each top level category (changing the 1 to the id of the category each time), and used wp_list_cats like in this example:

    <?php
    wp_list_cats('sort_column=name&hide_empty=0&child_of=1'); ?>

    changing the 1 to the same id number as I used in the filename for that template.

    ??

    Sounds like you went through a lot of work for that :(. It’s likely there’s a variable that’s set you could have used. Try creating one category.php template. In place of what you have, try the following:

    `<?php
    wp_list_cats(“sort_column=name&hide_empty=0&child_of=$cat”); ?>

    Note the double-quotes in place of the single-quotes, by the way. See if it works as expected.

    Thread Starter bratty

    (@bratty)

    yay! that works ?? ?? ??

    that was the kind of thing I was after. thankyou thankyou!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘display category links within a page?’ is closed to new replies.