From 7ac8eb922d729736f8ba6aacc5c083466b7465ed Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 20 Nov 2014 15:06:57 -0500 Subject: [PATCH] Rearrange js files To allow working with jquery from wordpress --- footer.php | 14 -------------- functions.php | 28 +++++++++++++++++++++++++++- header.php | 2 -- js/dollarsign.js | 8 ++++++++ js/pageSetup.js | 11 +++++++++++ 5 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 js/dollarsign.js create mode 100644 js/pageSetup.js diff --git a/footer.php b/footer.php index 207caab..85de942 100644 --- a/footer.php +++ b/footer.php @@ -20,20 +20,6 @@ - - \ No newline at end of file diff --git a/functions.php b/functions.php index 4473221..630e460 100755 --- a/functions.php +++ b/functions.php @@ -56,6 +56,32 @@ set_post_thumbnail_size(120, 100, true); */ function preston_feather_scripts() { + wp_enqueue_script( + 'modernizr', + get_template_directory_uri() . '/js/vendor/modernizr.js' + ); + wp_enqueue_script( + 'jquery', + get_template_directory_uri() . '/js/vendor/jquery.js' + ); + wp_enqueue_script( + 'dollarsign', + get_template_directory_uri() . '/js/dollarsign.js' + ); + wp_enqueue_script( + 'foundation', + get_template_directory_uri() . '/js/foundation.min.js', + 'jquery', + '1.0', + true + ); + wp_enqueue_script( + 'pageSetup', + get_template_directory_uri() . '/js/pageSetup.js', + 'foundation', + '1.0', + true + ); if(is_front_page()) { wp_enqueue_script( 'cycle_script', @@ -63,7 +89,7 @@ function preston_feather_scripts() 'jquery', '1.0', true - ); + ); wp_enqueue_script( 'glm_google_map_code', 'http://maps.google.com/maps/api/js?sensor=false', diff --git a/header.php b/header.php index ad35a6f..5783624 100644 --- a/header.php +++ b/header.php @@ -5,8 +5,6 @@ <?php wp_title(); ?> - - diff --git a/js/dollarsign.js b/js/dollarsign.js new file mode 100644 index 0000000..34d34e5 --- /dev/null +++ b/js/dollarsign.js @@ -0,0 +1,8 @@ +/* + * To avoid conflicts, Wordpress tends to prefer jQuery being used over $. + * As long as this file is included, no such conflicts should arise. Ensure it + * is called before other .js files using $. + */ + + +var $=jQuery.noConflict(); diff --git a/js/pageSetup.js b/js/pageSetup.js new file mode 100644 index 0000000..6d21e36 --- /dev/null +++ b/js/pageSetup.js @@ -0,0 +1,11 @@ +$(document).foundation(); +$(document).ready(function () { + $('ul.children').each(function () { + $(this).before(''); + }); + $('a.toggle').click('click', function () { + console.log('clicked me!'); + $(this).toggleClass('open'); + $(this).siblings('ul').toggleClass('open'); + }); +}); \ No newline at end of file -- 2.17.1