Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request #240 from olefredrik/feature/cleanup
Browse files Browse the repository at this point in the history
enqueue-scripts cleanup
  • Loading branch information
olefredrik committed Feb 21, 2015
2 parents 88affbd + 948f4c9 commit 21314e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 85 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ module.exports = function(grunt) {
'bower_components/foundation/js/foundation/foundation.tooltip.js',
'bower_components/foundation/js/foundation/foundation.topbar.js',

// Using all of your custom js files
// Include your own custom scripts (located in the custom folder)
'js/custom/*.js'

],
// Concat all the files above into one single file
// Finally, concatinate all the files above into one single file
dest: 'js/foundation.js',
},
},
Expand Down
90 changes: 7 additions & 83 deletions library/enqueue-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,98 +6,22 @@ function FoundationPress_scripts() {
// deregister the jquery version bundled with wordpress
wp_deregister_script( 'jquery' );

// register scripts - header
// register modernizr.js and put it in the <head> tag
wp_register_script( 'modernizr', get_template_directory_uri() . '/js/vendor/modernizr.js', array(), '1.0.0', false );
wp_register_script( 'jquery', get_template_directory_uri() . '/js/vendor/jquery.js', array(), '1.0.0', false );


// register scripts - footer
// register jquery.js, foundation.js and put them before the </body> tag
// if you'd like to cherry-pick the foundation components you need in your project, see Gruntfile.js lines 67-88
wp_register_script( 'jquery', get_template_directory_uri() . '/js/vendor/jquery.js', array(), '1.0.0', true );
wp_register_script( 'foundation', get_template_directory_uri() . '/js/foundation.js', array('jquery'), '1.0.0', true );

/*
wp_register_script( 'foundation.abide', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.abide.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.accordion', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.accordion.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.alert', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.alert.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.clearing', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.clearing.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.dropdown', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.dropdown.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.equalizer', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.equalizer.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.interchange', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.interchange.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.joyride', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.joyride.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.magellan', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.magellan.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.offcanvas', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.offcanvas.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.orbit', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.orbit.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.reveal', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.reveal.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.tab', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.tab.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.tooltip', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.tooltip.js', array('jquery'), '1.0.0', true );
wp_register_script( 'foundation.topbar', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.topbar.js', array('jquery'), '1.0.0', true );
wp_register_script( 'fastclick', get_template_directory_uri() . '/js/foundation/js/vendor/fastclick.js', array('jquery'), '1.0.0', true );
*/

// enqueue scripts
// enqueue all registered scripts
wp_enqueue_script('modernizr');
wp_enqueue_script('jquery');
wp_enqueue_script('foundation');

/*
wp_enqueue_script('foundation.abide');
wp_enqueue_script('foundation.accordion');
wp_enqueue_script('foundation.alert');
wp_enqueue_script('foundation.clearing');
wp_enqueue_script('foundation.dropdown');
wp_enqueue_script('foundation.equalizer');
wp_enqueue_script('foundation.interchange');
wp_enqueue_script('foundation.joyride');
wp_enqueue_script('foundation.magellan');
wp_enqueue_script('foundation.offcanvas');
wp_enqueue_script('foundation.orbit');
wp_enqueue_script('foundation.reveal');
wp_enqueue_script('foundation.tab');
wp_enqueue_script('foundation.tooltip');
wp_enqueue_script('foundation.topbar');
wp_enqueue_script('fastclick');
if(is_home() || is_front_page()):
wp_register_script( 'foundation.slider', get_template_directory_uri() . '/js/foundation/js/foundation/foundation.slider.js', array('jquery'), '1.0.0', true );
wp_enqueue_script('foundation.slider');
endif;
*/



}

add_action( 'wp_enqueue_scripts', 'FoundationPress_scripts' ,5);
endif;


if (!function_exists('FoundationPress_js_script')) :
function FoundationPress_js_script() {
?>
<script type="text/javascript">

if ( undefined !== window.jQuery ) {

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

(function( $ ) {

$(document).foundation();

})(jQuery);

})
}

</script>
<?php
}
add_action( 'wp_footer', 'FoundationPress_js_script',10);
add_action( 'wp_enqueue_scripts', 'FoundationPress_scripts' );
endif;

?>
?>

0 comments on commit 21314e9

Please sign in to comment.