Skip to content

Instantly share code, notes, and snippets.

@muzahedul03
Created February 27, 2017 05:46
Show Gist options
  • Save muzahedul03/c68f8a07923dfcd4931390d173f6898f to your computer and use it in GitHub Desktop.
Save muzahedul03/c68f8a07923dfcd4931390d173f6898f to your computer and use it in GitHub Desktop.
How to Use JS file in Wordpress using Function
<?php
//includes all felxo_theme_file_css
function flexo_theme_file(){
//include jS file
wp_enqueue_script('jquery');
wp_enqueue_script('easing-js', get_template_directory_uri(). '/js/jquery.easing.1.3.js', array('jquery'), '1.3', true);
wp_enqueue_script('bootstrap-js', get_template_directory_uri(). '/js/bootstrap.min.js', array('jquery'), '1.3', true);
wp_enqueue_script('fancybox-js', get_template_directory_uri(). '/js/jquery.fancybox.pack.js', array('jquery'), '1.3', true);
wp_enqueue_script('fancybox-media-js', get_template_directory_uri(). '/js/jquery.fancybox-media.js', array('jquery'), '1.3', true);
wp_enqueue_script('prettify-js', get_template_directory_uri(). '/js/google-code-prettify/prettify.js', array('jquery'), '1.3', true);
wp_enqueue_script('quicksand-js', get_template_directory_uri(). '/js/portfolio/jquery.quicksand.js', array('jquery'), '1.3', true);
wp_enqueue_script('setting-js', get_template_directory_uri(). '/js/portfolio/setting.js', array('jquery'), '1.3', true);
wp_enqueue_script('flexslider-js', get_template_directory_uri(). '/js/jquery.flexslider.js', array('jquery'), '1.3', true);
wp_enqueue_script('animate-js', get_template_directory_uri(). '/js/animate.js', array('jquery'), '1.3', true);
wp_enqueue_script('custom-js', get_template_directory_uri(). '/js/custom.js', array('jquery'), '1.3', true);
}
add_action('wp_enqueue_scripts', 'flexo_theme_file');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment