Unable to get wordpress register_nav_menus working

I am building my 1st theme, and got stucked with showing menu option on admin’s screen under appearance. I refered various support thread but none of the solution is working for me.

Codes in function.php

Read More
<?php
//Create Nav menu
if (function_exists(register_nav_menus)) {
register_nav_menus( array('primary' => 'Header Navigation') );
 }
 ?>

Codes in header.php

<?php
wp_nav_menu( array( 'container_class' => 'main-nav' , 'container'=>'nav') );
?>

I am executing this on localserver and wordpress version 4.0

image of header.php

http://i.imgur.com/ziPGH2G.png

image of function.php

http://i.imgur.com/ica5VJx.png

Thats all of it.

Please help me out.

Related posts

Leave a Reply

2 comments

  1. You’re missing some arguments (and a comma in your array). You need to pass in a menu name:

    $args = array(
        'menu'            => 'primary',
        'container'       => 'nav',
        'container_class' => 'main-nav',
    );
    
    wp_nav_menu( $args );
    

    Also be aware that this menu must exist in the admin, and must be assigned to the menu location you just created.