Site logo

Archived topic

Jquery installation

9 replies · Started by Daniele on May 13, 2019

Viewing posts 1–10 of 10

Hi, the plugins that need jquery don't work on gp, how can I install jquery on your theme?

Thanks,
Daniele

So I have to add this code to the functions.php file?

add_action( 'wp_enqueue_scripts', function() {
wp_enqueue_script( 'jquery' );
} );

Did I get it right?

Thanks Leo

Is it not quicker to add manually

add_action ('wp_enqueue_scripts', function () {
wp_enqueue_script ('jquery');
});

to the functions.php file?

Thanks

Never a good idea to edit the theme's core files as it will get erased during update.

I have to make changes also to the file footer.php and header.php, to insert banners. In the same way, I could change the functions.php file to insert the jquery function. If the theme is updated, I rarely redo the changes after each update, otherwise, if the updates are frequent, I will have to create a child theme ... what do you say?

Thanks

Our recommendation is always to create a child theme in cases like this but it’s up to you.

OK, I copied this code into the functions.php file

add_action( 'wp_enqueue_scripts', 'tu_load_jquery' );
function tu_load_jquery() {
wp_enqueue_script( 'jquery' );
}

and now everything works!

Thanks Leo!

Daniele

No problem :)

This archived topic is closed to new replies.