ThemeShaper Forums » Thematic

Displaying child category menu on parent pages

(5 posts)
  • Started 15 years ago by jazzyfinch
  • Latest reply from Chris
  • This topic is not resolved

Tags:

  1. First off, I want to say that I am a recent adopter of the Thematic Framework, and while I can't stress enough how incredibly noobish I am at PHP, this really isn't all that hard! Very nicely done Ian, Chris, and the rest of the team =) Of course, my lack of PHP know-how leads me to the following problem >.>

    What I am trying to do is create a 2 tiered menu system (that doesn't use dropdowns). When someone clicks on a parent category, I want the children of that category to display elsewhere on the page. So, all parent categories will be consistent across all pages, but the child nav will only show when its parent category is clicked.

    I have found a handful of tutorials that claim to accomplish just that, but haven't had any luck implementing any of them. I can handle the css of styling the menu, what I am stumbling on is getting the PHP to work >.< I am using the Thematic power blog, but I don't think this is an issue specifically relating to that theme.

    Has anybody accomplished this that could give me some pointers?

    Thanks in advance for any feedback!

    Kind Regards,
    Michele

    Posted 15 years ago #
  2. To elaborate on this, I am using the code from this site. Specifically:

    $cat = get_the_category();
    $id = $cat[0]->parent;
    
    $defaults = array(
    'show_option_all' => '',
    'orderby' => 'name',
    'order' => 'ASC',
    'show_last_update' => 0,
    'style' => 'list',
    'show_count' => 0,
    'hide_empty' => 0,
    'use_desc_for_title' => 1,
    'child_of' => $id,
    'feed' => '',
    'feed_image' => '',
    'exclude' => '',
    'hierarchical' => true,
    'title_li' => '',
    'echo' => 1,
    'depth' => 1
    );
    
    if($parents[0]->parent && !is_home())
    {
    echo "
    <ul>". wp_list_categories($defaults) ."</ul>
    ";
    }

    When I drop this into my functions.php in the correct spot (wrapped in PHP tags) it returns nothing. So for now, I am hard-coding my category pages, although I would really like to automate that if possible.

    Thanks in advance for any help or guidance you can provide.

    Kind Regards,
    Michele

    Posted 14 years ago #
  3. Take a look at:

    simple Section Navigation Widget

    Cheers,

    Chris

    Posted 14 years ago #
  4. Hi Chris!

    Thanks so much for the response! This is sort of what I was looking for, except it sounds like (from the description) it works with pages, not categories.

    I managed to string together a bunch of conditional statements for a quick and dirty solution but whether there is an elegant way of doing this, i'm not sure.

    Thanks for the help!
    Michele

    Posted 14 years ago #
  5. Hi Michele,

    sorry for this .. will try to find a solution for this.

    Cheers,

    Chris

    Posted 14 years ago #

RSS feed for this topic

Reply

You must log in to post.