How to Add JavaScript to your theme

From the last WordPress meetup, we discussed How to add javascript to your theme

Inside functions.php, hook into the wp-enqueue_scripts hook

add_action( 'wp_enqueue_scripts', 'wpmia_load-javascript_files');

function wpmia_load_javascript_files() {

wp_register_script( 'info-caroufredsel', get_template_directory_uri() . ' jquery.carouFredSel-5.5.0-packed.js', array ('jquery', '5.5.0', true);

...

...

wp_enqueue_script( 'info-carousel-instance' );

 

if ( is_front_page() ) {

wp_enqueue_script('home-page-main-flex-silder');

} 

}

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *