Changing the Position of the Elements in the Navbar

Viewing 4 posts - 1 through 4 (of 4 total)
  • #22985
    browebmaster
    Participant

    First of all, I would like to thank you for providing this wonderful theme! It is really very flexible and it made it easier for me to set up our school’s website in just a few days. Thank you very much!

    I encountered a difficulty however with the navbar for the website. The name of the school is quite long so that there is not enough space for the menus (whose texts are quite long as well). Also, the size of the logo of the school is not quite enough. Due to these, I thought that perhaps the navbar area could be modified. I hope I am not asking for too much but I was hoping that the header of the website could look like this:
    Website Header

    I would really appreciate any help that you can give. Thank you!

    #22986
    Daniel Tara
    Keymaster

    What you’re asking for is not supported natively by the theme and while possible, it would imply at least several hours of work and is not something that could be discussed over a support forum.

    Now before I outright dismiss your request I would like to point out that I have stumbled upon this situation before having things like a long website name and especially long menu item titles are symptoms of bad website structure. Ask yourself this: While browsing the internet have you ever encountered a relatively popular website that featured long navigation entries? There’s a good reason for that and that is that keeping navigation menu items short keeps the navigation menu accessible.

    There are several workarounds built into the theme that can help you create a more descriptive navigation. For example you can use menu descriptions to shorten the long titles. Also, you can hide the site title and integrate the name of the school in the logo image. This gives you greater freedom over font sizes and spacing.

    I hope this helps, I can’t do more for you at the time.

    #22993
    browebmaster
    Participant

    Ok. I understand the difficulty of my request so I decided to modify the design. I saw a post here in the forum for adding a second navigation bar. I would want it to appear under the Primary Navbar, above the slider. I checked the WordPress documentation and came up with this code:
    <div class="secondary-navigation"><?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?></div>`

    Where do I place the code to have the second navbar in the position I want?

    Thanks for all your help! I truly appreciate your response.

    #22995
    Daniel Tara
    Keymaster

    Unfortunately the code above alone is not going to work. Here’s a reliable way to add a second navigation menu:

    1. If you haven’t already, go ahead and create a child theme.

    2. In the child theme’s directory add a file called functions.php and the following code to it:

    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( ! doing_action( 'enlightenment_after_header' ) ) {
    		return;
    	}
    
        wp_nav_menu();
    }
    add_action( 'enlightenment_after_header', 'enlightenment_child_secondary_navigation', 1 );
    
    function enlightenment_child_secondary_nav_menu_args( $args ) {
        if( ! doing_action( 'enlightenment_after_header' ) ) {
            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 );

    You will most likely still need to style the navigation using custom CSS.

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

You must be logged in to reply to this topic.