Secondary navigation menu after slider.

Viewing 5 posts - 1 through 5 (of 5 total)
  • #22790
    Mary
    Participant

    I’m trying to create additional custom navigation menu: https://codex.wordpress.org/Navigation_Menus

    but I have a problem because duplicates the class from primary menu. Please help me, I truly need to create an additional with other styles in css.

    #22794
    Daniel Tara
    Keymaster

    Here’s a reliable way to add a navigation menu after the slider:

    function enlightenment_child_register_secondary_navigation() {
        register_nav_menu(
            'secondary',
            __( 'Secondary Menu', 'enlightenment' )
        );
    }
    add_action( 'after_setup_theme', 'enlightenment_child_register_secondary_navigation' );
    
    function enlightenment_child_secondary_navigation() {
        if( 'header' != enlightenment_current_sidebar_name() ) {
            return;
        }
    
        wp_nav_menu();
    }
    add_action( 'get_sidebar', 'enlightenment_child_secondary_navigation' );
    
    function enlightenment_child_secondary_nav_menu_args( $args ) {
        if( ! doing_action( 'get_sidebar' ) ) {
            return $args;
        }
    
        $args['theme_location']  = 'secondary';
        $args['container_class'] = 'secondary-navigation';
        $args['container_id']    = 'secondary-navigation';
        $args['walker']          = '';
    
        return $args;
    }
    add_action( 'wp_nav_menu_args', 'enlightenment_child_secondary_nav_menu_args', 22 );

    Now you’ll have a secondary navigation with a dedicated location and a container class and id of secondary-navigation

    #22796
    Mary
    Participant

    Daniel, thank you very much for your help! When I added the code to function.php showed me the second menu but when I have set CSS styles does not change anything. Please check this out: http://www.englishcom.eu/

    Truly appreciate and thank you for your help.

    • This reply was modified 8 years ago by Mary.
    • This reply was modified 8 years ago by Mary.
    #22799
    Mary
    Participant

    Daniel, now it works. I had to clear browsing data… Truly appreciate it and thank you very much for your help! πŸ™‚

    #22807
    Mary
    Participant

    Daniel, Could I ask you again for your help. I want make my secondary navigation menu tree or four columns items (depending on the resolution) I want to use flexbox solution. I have set CSS styles in .secondary-navigation-menu for example: add height: 300px but doesn’t work…

    Please check this out: http://www.englishcom.eu/

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

You must be logged in to reply to this topic.