• Aureola

    (@aureola)


    Hello,
    I’ struggling with understanding the concept of custom menus in WP. I have searched and read numerous tutorials, but most seem to be treating much more intricate and difficult topics than the one I’m having.
    I have a CSS-class with some styling that I would like to apply to the main menu (and because I know I will use one more navigation later on, and it didn’t seem to add much difficulties, I register one extra menu as well in functions.php.

    I’ve been reading through and tryied to apply the code from https://codex.www.ads-software.com/Function_Reference/register_nav_menu
    https://wordpress.stackexchange.com/questions/32186/how-to-create-a-custom-wordpress-navigation-menu-with-the-code
    and https://codex.www.ads-software.com/Navigation_Menus

    But my WP doesn’t seem to care at all; my menu is still looking like an unstyled unordered bulleted list.

    Here’s my code:
    Functions.php:

    function register_my_menus() {
                register_nav_menus(
                        array(
                            'header-menu' => __('Header Menu'),
                            'extra-menu' => __('Extra Menu')
                        )
                        );
    }
            add_action('init', 'register_my_menus');

    In Header.php:

    <div id="navbar">
    
    	<?php wp_nav_menu( array( 'theme_location' =>   'header-menu' , 'container_class' => 'bmenu' )); ?>
    
            </div><!--End div id navbar -->

    And the corresponding css (an excerpt, it would be too long with all the different selectors):

    .bmenu{
    	styling...bla bla bla
    }
    .bmenu li{
    	styling... and so on
    }

    Can anyone please help out? I really want to know where I have gone wrong.

Viewing 1 replies (of 1 total)
  • Thread Starter Aureola

    (@aureola)

    Oh, I just want to add that in the back-end interface (the administration panel) I have renamed my menu to Header Menu.

    One of the pages promised that whenever I register a new menu name, it would show up in the admin-interface, in Menu settings, but I have never seen any menus displaying there for me to select – I can but type in whatever name I want. So I don’t really get this, where I’m supposed to connect the menu in the admin panel to the registered menu name in functions.php.

Viewing 1 replies (of 1 total)
  • The topic ‘Trying to customize my main menu but no luck’ is closed to new replies.