Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development Building Out WordPress Navigation Coding A Basic Navigation in WordPress

Jennifer Crawshaw
Jennifer Crawshaw
17,878 Points

Nav Menu not functioning

My menu in not functioning. When you click the icon, nothing happens. I have checked all of my code to the final code from the project, I cannot find any errors. I also have made sure the menu is configured in the admin area.
My header.php:

```<!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php wp_title(); ?></title>

<?php wp_head(); ?>

</head>

<body> <header class="row no-max pad main"> <h1><a class='current' href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1> <a href="" class="nav-toggle"><span></span>Menu</a> <nav> <h1 class="open"><a class='current' href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>

  <?php
    $defaults = array(
        'container' => false,
        'theme_location' => 'primary-menu',
        'menu_class' => 'no-bullet'
      );
    wp_nav_menu( $defaults );
  ?>```

My functions.php

add_theme_support( 'menus');

function register_theme_menus() {
  register_nav_menus(
    array(
      'primary-menu' => _('Primary Menu')
    )
  );
}
add_action( 'init', 'register_theme_menus');

3 Answers

go appearance > menus > manage locations choose primary menu : Main Menu;

then go appearance > menus > edit menus

theme locations [X] Primary Menu (ticked)

Jennifer Crawshaw
Jennifer Crawshaw
17,878 Points

Yes, I have already checked those settings, and it is not functioning

Did you ever figure this out?? I am so stuck it's been hours I've tried everything!