• spherical

    (@spherical)


    Okay, this one has me really stumped. Specifically, I have a Multisite blog running a text widget to display an Artfire Shop Window in the sidebar. Used to work but, probably after WP 3.1 upgrade, does no longer.

    Tested, swapped out a lot of variables and found that if there is Javascript in the widget that depends upon JQuery, the JQuery call must be IN the widget for the Javascript that runs the Shop Window to work.

    NB!: This isn’t a problem of running Javascript in a text widget. The Javascript code that runs the Shop Window is IN the widget and runs just fine IF it sees JQuery. Putting the JQuery call in the widget allows it to work.

    The code supplied by Artfire loads JQuery from their location but it is 2008 vintage v1.2.6 and it isn’t even minified! Talk about being behind the times! …but I digress.

    JQuery 1.5.1 is already globally loaded sitewide via Use Google Libraries and is properly enqueued at an early stage, so should be available. I thought I’d found a hack to save page load time by swapping out Artfire’s JQuery 1.2.6 call for the Google library; figuring that it would recognize that it is already loaded and simply not load a second one. Instead, two JQuery 1.5.1 instances show up. Better two of the good one, than loading an ancient version, but it’d be nice to get the widget to see the JQuery that is already loaded and available.

    Yes, as part of the debugging, I temporarily deactivated the Use Google Libraries plugin and let the system load the JQuery 1.4.4 shipped with WP 3.1. No difference. If the call to any library isn’t in the widget itself, the Javascript that runs the Shop Window fails.

    What am I missing, here?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter spherical

    (@spherical)

    Followup to this that I forgot to include: Using a widget that is designed to run PHP, Javascript, etc., makes no difference. This is verified by the facts that:

    • It used to work in a plain text widget without the separate JQuery call
    • Adding a separate JQuery call before the Javascript call – it works

    I think it’s a fine line with script calls, as opposed to bare script code in the widget itself. When I think of that one way, it seems logical. When I think of it the other, it doesn’t make any sense. Code is code, no matter how it gets in there but something’s different.

    Thread Starter spherical

    (@spherical)

    OK, it’s been 6 months and no ideas have been offered on this, let alone a resolution, so I’d say that a bump is not out of order. WP v3.2.1 widgets still ignore enqueued jQuery. In order to get the widget to run, I have to load a second instance. Anyone have a way to thwack a widget that is calling an external Javascript to make it use the already-loaded code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JQuery not seen by text widget’ is closed to new replies.