Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter mikeill

    (@mikeill)

    I mean jQuery not defined.

    Plugin Author welshhuw

    (@welshhuw)

    It may be due to jQuery not being loaded in the header of you’re theme correctly?

    Do you have a link I could check please?

    Thread Starter mikeill

    (@mikeill)

    Here’s the link: here

    Plugin Author welshhuw

    (@welshhuw)

    No link?!

    Thread Starter mikeill

    (@mikeill)

    whoops. updated.

    Plugin Author welshhuw

    (@welshhuw)

    Hi

    I’m not seeing any errors. It seems that the plugin JS and jQuery is being loaded in correct order.
    The images you have don’t have any anchor links around them though, so the plugin won’t kick in yet.

    Thread Starter mikeill

    (@mikeill)

    You’re right. There was a conflict until I disabled the component of the Roots/Soil plugin that was loading (not) jQuery from CDN:

    namespace Roots\Soil\JqueryCDN;
    
    /**
     * Load jQuery from Google's CDN with a local fallback
     *
     * You can enable/disable this feature in functions.php (or lib/config.php if you're using Sage):
     * add_theme_support('soil-jquery-cdn');
     */
    function register_jquery() {
      if (!is_admin()) {
        $jquery_version = $GLOBALS['wp_scripts']->registered['jquery']->ver;
    
        wp_deregister_script('jquery');
    
        wp_register_script(
          'jquery',
          'https://ajax.googleapis.com/ajax/libs/jquery/' . $jquery_version . '/jquery.min.js',
          [],
          null,
          true
        );
    
        add_filter('script_loader_src', __NAMESPACE__ . '\\jquery_local_fallback', 10, 2);
      }
    }
    add_action('wp_enqueue_scripts', __NAMESPACE__ . '\\register_jquery', 100);

    Now it’s working as expected I think. Images need to link to “media” right?

    Thank you.

    Plugin Author welshhuw

    (@welshhuw)

    That’s correct; link to media.

    Glad you found the issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘jQuery NoConflict?’ is closed to new replies.