Tag Info

Hot answers tagged

4

From your comment above I read This is one of the reason why i am looking for a way to say to wordpress: "hey, i added those js files, dont worry". This is whole purpose of this question I think is perfectly fair, I +1ed your Q but the problem is that way does not exists, or better does not exists a clean, canonical way. How To first of all you ...


2

The jQuery library packed with WordPress, operates under noConflict mode. Means you can not use $ in your jQuery snippet/code. Either use jQuery instead of $. or use noConflict wrapper like this. <script type="text/javascript"> <!-- jQuery(document).ready(function($) { // your jquery function, you can use $ here. }); // ...


2

Today I needed to do more or less same thing, ending up on an alternative solution, that I want to share in case it can be useful for someone. I wrote a custom class extending WP_Script, something like this: class GM_Scripts extends WP_Scripts { static function buildFromWp( WP_Scripts $scripts ) { $class = get_called_class(); $obj = ...


1

It is a little hard to quickly audit WP code base for wordpress.org links, because they are extensively used in inline documentation. On top of my head the main (if not only) requests are probably to api.wordpress.org for updates. For resources WP generally only uses bundled assets. The two notable exceptions are: Deprecated libraries (such as prototype), ...


1

Use wp_localize_script() to pass any kind of data to your loaded scripts, in this case we need plugins_url(): wp_enqueue_script('my-script', get_stylesheet_directory_uri() . '/js/my-script.js'); wp_localize_script('my-script', 'myScript', array( 'pluginsUrl' => plugins_url(), )); Now you will have access to myScript.pluginsUrl in your script file: ...


1

There is a priority in URL parsing, and page related parsing is the lowest priority, or you might say that page is the default parsing applied when nothing else works. In your example wordpress will first try to treat the URL as a post and if no matching post is found it will try to find a page matching the URL.


1

Why don't you just de-Register those handles to 6 different files, and re-register those handles to one combined file? I think if you have 6 different handles, pointing to one file, WordPress will enque this file just once. So you can guarantee that your dependencies dont break up. Is this an possible solution for you?



Only top voted, non community-wiki answers of a minimum length are eligible