• Hi,

    I want add external jQuery script to WP theme but don’t know how I must do it.

    Anyone can help?

    Thanks,

    • This topic was modified 5 years, 9 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Is this for a theme to be hosted in the WordPress.org directory?
    Plugins and themes hosted on WordPress.org are not supposed to add their own jQuery libraries. Additionally, any code that “phones home” requires opt-in consent.

    @roosw19

    Add the following code on function.php & that should help you.

    function themeslug_enqueue_script() {
        wp_enqueue_script( 'jquery-v-2', 'http://code.jquery.com/jquery-2.1.3.min.js', false ); //External Link
        wp_enqueue_script( 'mycustomJs', get_template_directory_uri() . '/default.js', false );
        // here you can enqueue more js / css files 
    }
    
    add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' );
    • This reply was modified 5 years, 10 months ago by Sundar.
    • This reply was modified 5 years, 10 months ago by Sundar.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Add External jQuery Script on WP Theme’ is closed to new replies.