WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Categories and sub-categories displaying in sidebar (3 posts)

  1. posiesplace
    Member
    Posted 8 years ago #

    Would someone be able to help me out with some coding advice, at the moment I retrieve my categories with the following code:

    <h2><?php _e('Categories'); ?></h2>
    <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','') ?>
    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    <?php get_links_list(); }?>

    This displays all my categories in one list but since I have some sub-categories and I would like these to be shown as sub-categories in my sidebar.

    How do I go about this?

    Many thanks in advance.

  2. moshu
    Member
    Posted 8 years ago #

    You could replace the template tag used in your sidebar with something else, and/or play with the parameters:
    http://codex.wordpress.org/Template_Tags#Category_tags

    (BTW, only this line of code is displaying your cats:
    <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','') ?> - everything after that is for Links/Blogs)

  3. posiesplace
    Member
    Posted 8 years ago #

    From that codex entry I think the parameter I want is

    <?php list_cats()>

    hierarchical
    (boolean) Sets whether to display child (sub) Categories in a hierarchical (after parent) list. Valid values:

    * TRUE (Default)
    * FALSE

    How do I go about implementing this?

    I have tried a couple of things but so far nothing has worked.

    Any help would be really appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic