[wp-hackers] i love wordpress support for php functions, but this what happens with every upgrade of jquery...

Nikola Nikolov nikolov.tmw at gmail.com
Wed Oct 9 09:42:48 UTC 2013


Well a simple solution is to simply register your own version of jQuery and
stick to it. Keep in mind that this might break other plugins that depend
on the latest version of jQuery.

Here's a sample code:

function my_enqueue_scripts() {
    // De-register the core version of jQuery
    wp_deregister_script( 'jquery' );

    // Register our version of jQuery and our script that depends on that
version of jQuery
    wp_register_script( 'jquery', get_bloginfo( 'template_directory' ) .
'/js/jquery.js' );
    wp_register_script( 'my-jquery-dependent-script', get_bloginfo(
'template_directory' ) . '/js/script.js', array( 'jquery' ) );

    // Enqueue the custom script
    wp_enqueue_script( 'my-jquery-dependent-script' );
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts', 10 );


Now, please keep in mind the following: someone else might come after you
and make changes on the theme, or poke around it. Please leave a note as to
why exactly you're using the exact version of jQuery that you're using, so
that the next person doesn't suffer too much :) And I assume that the
syntax that comes with jQuery 1.10 will stick around for longer, so at
least update your themes to use 1.10 and then use local version of 1.10

Nikola


On Wed, Oct 9, 2013 at 12:31 PM, Konrad Karpieszuk <kkarpieszuk at gmail.com>wrote:

> Hi people
>
> I think one of most important thing in wordpress is that it supports even
> old wordpress api functions (just throwing notice that this is depracated
> and you should consider to use new way of doing this thing). This very
> important argument when you propose to your customer to build website on
> wordpress: you can tell him that website will work for years, and he/she
> don't have to be affraid of making wordpress core upgrades.
>
> But this what happens after every upgrade of wordpress which delivers new
> version of jQuery i can comment only in three letters: WTF?! :)
>
> Today i upgraded one website of my customer to wp 3.6.1 which brings jquery
> 1.10. And after that all sliders based on jquery tabs stopped to work.
>
> I found reason: in my sliders i heavily use method 'selected' which in new
> version of jQuery is called 'active' and i use 'fx' - now i should use
> 'show' option.
>
> I changed that, but what with other websites? I developed tens of them
> where i am sure problem will be the same after wordpress upgrade.
>
> And also few months ago i sam that jquery tabs method 'rotate' also was
> castrated. Then i found some plugin which brought it back.
>
>
> But this is silly! I include jquery and jquery-ui-tabs using
> wp_enqueue_script every time - in the way how codex.wordpress suggest to do
> this. Now it looks that because of wp upgrades you cannot depend on this.
>
> I cannot tell my customers not to upgrade wordpress, because of that
> animations will stop to work. Also i cannot charge thetm for my additional
> work after every wordpress upgarde - this is not the way how i cooperate
> with customers.
>
> I know that the problem is in jQuery way of development, not in wordpress,
> but maybe you - wordpress core developers - have some idea how to deal with
> it?
>
> --
> (en) regards / (pl) pozdrawiam
> Konrad Karpieszuk
> http://tradematik.pl wtyczka do WordPressa do tworzenia sklepów dla
> klientów z Polski
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list