Wednesday 1 April 2015

How to add Jquery in footer in wordpress

How to add Jquery in footer in wordpress

Hello

here the if you want add jquery file (js file) in footer then 
check it below code.

<?php
function myphpinformation_scripts() {    
            wp_enqueue_script( 'scroll', get_stylesheet_directory_uri() . '/js/script.js',array('jquery'),'',true);
}

add_action( 'wp_enqueue_scripts', 'myphpinformation_scripts' );
?>
if you want to add any js file in to footer please set parameter true

Forth parameter for  wp_enqueue_script my default is flase if you
Want to add footer it makes it true check in my myphpinformation_scripts ()  function. 

i think this blog can help to add jquery in footer
.

if you want to add any js file under another js file
in array('jquery')  in my function add name theorefy our
js giving in  wp_enqueue_script

If I want to add  aftrer script. js then check below code

 wp_enqueue_script'scroll', get_stylesheet_directory_uri() . '/js/script.js',array('scroll'),'',true)
;

add this type. array('scroll').

scroll name of added js check in function
check it i hope it can help.

No comments:

Post a Comment

Thank You For Comment