Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3246

    Hello – Please see http://thesmarterscienceofslim.com/the-blog/. “natural balanced diet” is a child category of “exercise less–smarter,” and “balance vs. low-carb” is a child of “natural balanced diet.” how can i make it so only my top level parent categories show up in the side bar AND in the footer.

    Thanks!

    #41345

    Hey,

    There are 2 ways to acomplish this:

    1.) Choose the categories to exclude under Blog options in WP Admin, this will exclude them from the sidebar and footer widgets.

    2.) Modify the code in the sidebar.php and footer.php files to automatically exclude any category which is not a top level category. To do this find this code in both files:

    <?php wp_list_cats('sort_column=name&optioncount=0&hierarchical=0'.$exclude); ?>

    Change it to:

    <?php wp_list_cats('sort_column=name&optioncount=0&hierarchical=0&depth=1'.$exclude); ?>

    I’ve added depth=1 which should now only display top level categories.

    James

    #41346

    Thanks so much James!

    #41347

    Glad that James could help you :)

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘show only top level categories’ is closed to new replies.