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 The wp_nav_menu Function

Mike Ferrari
Mike Ferrari
3,239 Points

Navigation Won't Show Even After foundation.min.js Change and Fixing JQuery Reference Error

Here is current code for fuctions.php:

functions.php
<?php

add_action( 'wp_enqueue_scripts', 'wpt_theme_styles' );

function wpt_theme_js() {

    wp_enqueue_script( 'modernizr_js', get_template_directory_uri() .
    '/js/modernizr.js', '', '', false );
    wp_enqueue_script( 'foundation_js', get_template_directory_uri() .
    '/js/foundation.min.js', array('jquery'), '', true );
    wp_enqueue_script( 'main_js', get_template_directory_uri() .
    '/js/app.js', array('jquery', 'foundation_js'), '', true );

}
add_action( 'wp_enqueue_scripts', 'wpt_theme_js' );

?>

Here is code for app.js file:

apps.js
 jQuery(document).ready(function($) {

    $(document).foundation();

    $( ".nav-toggle" ).click(function() {
          $(this).toggleClass("open");
          $("nav").fadeToggle(100);
          return false;
    });
 });

The nav hamburger still does not work. Does anyone have any recommendations?

Austin Whipple
Austin Whipple
29,725 Points

Cleaned up your pasted code a bit. Be sure to check out the Markdown Cheatsheet below the text editor for more information.

1 Answer

Austin Whipple
Austin Whipple
29,725 Points

There's no code here that specifically places a hamburger icon anywhere. Is that in the CSS somewhere? Did you make sure to include any HTML required by Foundation to add the menu? I'd double check all the steps required by the framework to make sure everything's in place.

If that still doesn't clear it up, is the browser's console reporting any errors?