Ok, first of all, I know how to do this manually.
I could just download easing, place it in my plugin folder and load it using wp_enqueue_script
. However, I want to load my script in a long-term way, ensuring that I use the same version of the easing script wordpress uses.
So what I am looking for, is a way to load easing in wordpress using wp_enqueue_script
, as seen below. I have looked at the function reference for wp_enqueue_script
, but I can’t seem to find the right file/handle to enqueue. Is there anyone who knows how to load the WordPress-native easing script?
//I know this works because I've used it a thousand times already
wp_enqueue_script("jquery");
//I want something like this without having to use my own script
wp_enqueue_script("jquery-easing");
2 Answers
If you refer to this script, this is not included in wordpress.
See the codex for list of scripts included in wp you will not find it.
If you don’t trust codex, you can look into the folder wp-includes/js
and search for easing script… it’s not there.
Edit (additional info)
Answer above just ‘strictly’ respond to the OP question, because the plugin he want to include actually is not a standard wordpress script.
However, as @Johannes Pille noticed in his answer, jQuery UI Effects that is a standard wordpress script that can be enqueued using wp_enqueue_script("jquery-effects-core")
, contains easing functions.
This easing function was introduced by jquery team independently from the plugin mentioned by OP. In old version of jquery ui the easings available were less than now (I can’t remember in which version all easing has been introduced) and to use some advanced easings it was necessary using the mentioned plugin.
When jquery team insert all now available easing, plugin developer update and rename his plugin easing functions to be compatible with jquery ui ones (all are implementation of Rober Planner equations).
So, if someone has scripts that rely on the old-named plugin function must use the plugin, preferably the compatibility version).
If old names are not requested, standard wordpress jquery-effects-core
can be used as well.
Please also notice that the plugin script minified is less than 4kb, jquery-effects-core minified is 12.76 kb, so if effect is not needed including the plugin is probably better.
On the other side, including the plugin and jquery ui effects does not make sense (unless, again, there are scripts that rely on old-named plugin easing function).