The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Category based navigation menu (1 post)

  1. membrana
    Posted 7 years ago #

    I've been searching for some guidance on this subject but to no avail.
    I want to have an horizontal menu that displays all my parent categories, and when I click on one of those, below it displays another horizontal menu but with the child categories of the clicked one.
    The styling I think I can handle, but the php that would display the correct children upon clicking on the parent is what I cannot get right.

    I've found that this kind of menu is very used but with pages instead of categories. This is a code I found and I replaced every 'pages' for 'categories', but it didn't work (it was worth trying...).

    <ul id="nav">
         <?php wp_list_categories('depth=1&title_li='); ?>
    <?php if(wp_list_categories("child_of=".$post->ID."&echo=0")) { ?>
         <ul id="nav-sub">
              <?php wp_list_categories("title_li=0&child_of=".$post->ID."&sort_column=menu_order");?>
    <?php } ?>

    Any help will be appreciated.
    Thank you very much for your time!


Topic Closed

This topic has been closed to new replies.

About this Topic