subnav dependent on post category

Community Forums Forums Design Tips and Tricks subnav dependent on post category

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  gretchenlouise 1 year, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35468

    gretchenlouise
    Participant
    Post count: 9

    I’ve been using Simple Menus to use a different subnav menu on particular pages and categories. I wish it had an option to automatically set the menu to apply to all posts within specific categories, as well.  Previously, I’d been using Prose, and the code below my functions.php. But now that I’m using Genesis itself, it breaks the styling and makes the menu extremely ugly on any post or category page in my chosen category. Any ideas on what the conflict might be? Thank you!

    <code>// Subnav dependent on category
    remove_action(‘genesis_after_header’, ‘genesis_do_subnav’);
    add_action(‘genesis_after_header’, ‘custom_do_subnav’);
    function custom_do_subnav() {
    echo ‘<div id=”subnav”><div>’;
    if ( in_category(‘tech’)  && !is_front_page() && !is_home() ) { wp_nav_menu( array(‘menu’ => ‘Tech’ ));
    }
    else {
    genesis_do_subnav();
    }
    echo ‘</div></div>’;
    }

    </code>

    #35818

    braddalton
    Participant
    Post count: 10261

    What theme are you using?

    Can you link to your site please.


    #35829

    gretchenlouise
    Participant
    Post count: 9

    Thank you. I just finally got it working (at http://gretchenlouise.com/) by using more specific div classes:

    `echo ‘<div id=”subnav”><div class=”wrap”><ul id=”menu-tech-2″ class=”menu genesis-nav-menu menu-secondary superfish sf-js-enabled”>’;`

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

You must be logged in to reply to this topic.