WordPress.org

Ready to get started?Download WordPress

Forums

Use Google Libraries
[resolved] JQuery plugins (2 posts)

  1. eperinelli
    Member
    Posted 1 year ago #

    i everybody

    this plugin works perfectly for me

    being a noob with JQuery, i would like to ask: what's the best practice to have WP load also a JQuery Plugin?

    thanks in advance

    http://wordpress.org/extend/plugins/use-google-libraries/

  2. Jason Penney
    Member
    Plugin Author

    Posted 1 year ago #

    It's the same with or without UGL installed.

    You'd use wp_register_script and wp_enqueue_script and register the script with a dependency on jquery.

    wp_register_script('jquery.plugin-name',
                       get_template_directory_uri() . '/js/jquery.plugin-name.js',
    		   array('jquery'),
                       $jquery_plugin_version,
                       $in_footer);

    Be sure to read the docs so you don't use those functions in the wrong places (they should only be called from the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts actions):

    https://codex.wordpress.org/Function_Reference/wp_register_script
    https://codex.wordpress.org/Function_Reference/wp_enqueue_script

    Be sure to test with and without UGL enabled.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.