Forums

Is it possible to show parent categories on one nav and child on another? (5 posts)

  1. jtayberry
    Member
    Posted 1 year ago #

    Thanks in advance for the help. I've studied the archives and have yet to find an answer to my need.

    My blog is going to have a bunch of niche sports articles in one blog. Each sport will be a parent category with applicable child categories under each parent. I was hoping to put each parent category on the top navigation (probably hard coded), and then depending on the parent, the child categories shown on the right side bar. Since each parent is so different, i would rather not show the other parents on the right side nav, just the child cats for the applicble parent.

    The only solution that I have come up with (if it so important to me to have the parent categories not mix together) is to have a separate blog for each niche under the main URL placed in different directories. /golf/ /tennis/ /biking/. of course i would prefer not to have to do a new installation for each added sport.

    Thanks.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    It's possible. You'd need to grab the current category id - so something like:

    <?php if( is_category() ) :
    $current_cat_name = single_cat_title('', false)
    $current_cat_id = get_cat_ID( $cat_name ); ?>
    if( wp_list_categories('title_li&echo=0&child_of=' . $current_cat_id) ) wp_list_categories('title_li&child_of=' . $current_cat_id); ?>
    endif;?>

    in your sidebar template file should work.

  3. govpatel
    Member
    Posted 1 year ago #

    You could use custom types check this out may be that will work for you.
    http://codex.wordpress.org/Custom_Post_Types

  4. jtayberry
    Member
    Posted 1 year ago #

    thanks, that is very helpful.

  5. govpatel
    Member
    Posted 1 year ago #

    I was checking and researched and found this plugin
    Custom Post Type UI
    may this will do what you want.

Topic Closed

This topic has been closed to new replies.

About this Topic