WordPress.org

Ready to get started?Download WordPress

Forums

Using jQuery from an external domain (3 posts)

  1. Konstantin Kovshenin
    Member
    Posted 4 years ago #

    Hey there, I'm running WordPress 2.8.5, I've got a custom theme with a wp_enqueue_script('jquery'); in the header.php file. Works okay, but now I'm trying to get rid of all the static content on my domain and move it to a CDN, Amazon CloudFront in my case. All the custom javascripts, css and images move fine, but I can't manage to move the jQuery library by using wp_enqueue_script('jquery', 'http://s.kovshenin.com/js/jquery.js');, it's still being served from the standard wp-includes folder.. I think the handle is the problem and changing it to jquery-custom for instance would do the job, but I've got some other plugins that may be jquery dependant and define 'jquery' in the dependencies list in the wp_enqueue_script function, thus jquery will be included twice.

    Any ideas on how to fix that?
    Thanks in advanced.

    ~ @kovshenin

  2. Mark / t31os
    Moderator
    Posted 4 years ago #

    Not sure if this helps at all, but when you do..

    wp_enqueue_script('jquery');

    WordPress will check to see if it's loaded already, and if so, it doesn't included again..

    Just thought that might be worth mentioning.. :)

  3. Konstantin Kovshenin
    Member
    Posted 4 years ago #

    Err, that actually IS my problem, I cannot define a different location for the default jquery handler, thus using jquery-custom, but that would break with scripts that depend on jquery (as a handler).

Topic Closed

This topic has been closed to new replies.

About this Topic