[Resolved] Jquery installation

Home Forums Support [Resolved] Jquery installation

Home Forums Support Jquery installation

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #897944
    Daniele

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

    Thanks,
    Daniele

    #897958
    Leo
    Staff
    Customer Support

    Hi there,

    If a plugin requires jquery, it should load it and not rely on the theme itself.

    This should help: https://generatepress.com/forums/topic/theme-conflict-with-wp-simple-paypal-shopping-cart-jquery-checkout-error/#post-888060

    Let me know if this helps 🙂

    #898028
    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

    #898030
    Leo
    Staff
    Customer Support

    One of these methods should work.

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    #898173
    Daniele

    Is it not quicker to add manually

    add_action (‘wp_enqueue_scripts’, function () {
    wp_enqueue_script (‘jquery’);
    });

    to the functions.php file?

    Thanks

    #898176
    Leo
    Staff
    Customer Support

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

    #898245
    Daniele

    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

    #898246
    Leo
    Staff
    Customer Support

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

    #901775
    Daniele

    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

    #901777
    Leo
    Staff
    Customer Support

    No problem 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.