Skip to content

Instantly share code, notes, and snippets.

@brentini
Forked from muzahedul03/function_js.php
Last active March 23, 2018 21:28
Show Gist options
  • Save brentini/69bec5cc15aff3f0320fbf9a814d56ae to your computer and use it in GitHub Desktop.
Save brentini/69bec5cc15aff3f0320fbf9a814d56ae to your computer and use it in GitHub Desktop.
How to Use JS file in Wordpress using Function #wordpress
<?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