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
Dean Yeong
10,053 PointsInsert Foundation 5 Off Canvas to Wordpress
Hi, I have trying to build me website with Foundation 5 framework with an off-canvas menu, but after a long try, I can't get my off-canvas working in the theme.
The style and the markup is fine, it seem like I can't get the Javascript working. Here is my function.php. Correct me if there is a mistake. Thanks a lot.
<?php
// Load Theme JS
/* load modernizr from foundation */
function modernize_it(){
wp_register_script( 'modernizr', get_template_directory_uri() . '/js/modernizr.js' );
wp_enqueue_script( 'modernizr' );
}
add_action( 'wp_enqueue_scripts', 'modernize_it' );
function wp_foundation_js(){
wp_register_script( 'wp-foundation-js', get_template_directory_uri() . '/js/foundation.min.js', 'jQuery', '', true);
wp_enqueue_script( 'wp-foundation-js' );
}
add_action('wp_enqueue_scripts', 'wp_foundation_js');
function foundation_js(){
wp_register_script( 'foundation-abide', get_template_directory_uri() . '/js/foundation/foundation.abide.js', 'jQuery', '', true );
wp_enqueue_script( 'foundation-reveal' );
wp_register_script( 'foundation-reveal', get_template_directory_uri() . '/js/foundation/foundation.reveal.js', 'jQuery', '', true );
wp_enqueue_script( 'foundation-reveal' );
wp_register_script( 'foundation-offcanvas', get_template_directory_uri() . '/js/foundation/foundation.offcanvas.js', 'jQuery', '', true );
wp_enqueue_script( 'foundation-offcanvas' );
}
add_action('wp_enqueue_scripts', 'foundation_js');
// Enanle Custom Menu
add_theme_support( 'menus' );
?>
Or any piece of information or code I should provide to have a better understanding for better advice?
5 Answers
Dean Yeong
10,053 PointsI found the solution for my problem. Thanks who ever intend to help. Thanks.
Lindsey Jones
140 PointsIs it possible to integrate multiple menus from the Wordpress backend into the Off-canvas menu using the foundation off-canvas list/label sections. So for example, each "label section" could call a unique menu that the end client has added in Wordpress? If anyone knows how to work this miracle, I'll be ever so grateful!
Kelvin Atawura
Front End Web Development Techdegree Student 19,022 PointsDean Yeong do you can to share the solution as l am having the same issue here.Thanks
Rhoda Toynbee
18,938 PointsHaving the same problem. Can you tell us how you fixed it please? :)
Kelvin Atawura
Front End Web Development Techdegree Student 19,022 PointsHi Rhoda Toynbee l have been able to solve it aswell. do you want to open up a new post in the forum for this so that we can help?