Quantcast
Channel: Wordpress API - Developer Code Book » wordpress tutorial
Viewing all articles
Browse latest Browse all 6

Load the jQuery in the wordpress footer

0
0

Many latest framework are loading all javascript in footer. They reduse the page loading the errors. But wordpress load the jquery and other javascript in header.
But using following code you can load your javascripts and jquery in footer area. You just need to copy and paste the following code into the functions.php file.

function wpai_add_jquery_in_footer( &$scripts) {
	if ( ! is_admin() )
		$scripts->add_data( 'jquery', 'group', 1 );
}
add_action( 'wp_default_scripts', 'wpai_add_jquery_in_footer' );

After doing the this you js scripts will load in footer. This js will load in footer for only normal users, Not for admin user.

wordpress-footer-jquery

 


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images