Still No jQuery Accordion in WordPress 3.1?

Update: Just posted a ticket to core trac. Response was that new JavaScript libraries tend to only get included if they are used in WordPress core, which explains why it isn’t added (yet). I think that it should be considered though because of its usefulness, and tiny file size!

There seems to be a bit of a shake up in the jQuery UI files included with WordPress 3.1. Firstly there is a new UI version (1.8.7), rather than 1.7.3 which was included in WordPress 3.0.4.

Also, the jQuery core files have been broken out of the single ui.core.js file into four separate files: ui.core.js, ui.mouse.js, ui.position.js, ui.widget.js. This makes it a little clearer what core UI components are included with WordPress. You can see this more clearly in the screen shot below. The core files are outlined in red.

There are two new UI widgets available in jQuery, and one of these, the button widget, has made it into WordPress 3.1. The autocomplete didn’t make it in. This is not a surprise as this might not be required that much at the moment, but users may need this as more autocomplete examples pop-up around the web.

I am a little disappointed though at the lack of inclusion of the accordion widget which has been around for a while now, and is a very useful addition to your web pages. There may be a good reason for this, that I am not aware of, but at just 9 KB it is very small and could be included without anyone hardly even noticing!

I use a lot of jQuery accordions for theme/Plugin options pages and find it a hassle to have to add in the accordion widget manually. It is not really a big issue, but it’s conspicuous by its absence. Anyone else know why it is not shipped along with the other WordPress jQuery files? Let me know in the comments if you do.

Oh, and the datepicker widget would be nice too. However this is around 35 KB so might be seriously considered for now. Anyway, just imagine being able to pick the date from the nice jQuery datepicker rather than have to manually enter the date/time as you do now. 😉


Find the Admin URL in WordPress 3.0

The other day I was looking for a way to get the URL to the installed WordPress admin folder. I was almost certain that I would have to ‘construct’ this URL manually. This wasn’t a problem I had done similar tasks many times before.

But to my pleasant surprise I found a nifty little function called get_admin_url(), which I didn’t know existed. This is probably as it is a new addition to WordPress 3.0. The function can be found in the /wp-includes/link-template.php file at line number 1950. You can see the full source code here.

Looking at the core code it is obvious that this function was written with a more general purpose in mind. In fact it returns the WordPress admin URL of multi-site blog with a specific ID. If you don’t specify a particular ID then it returns the current blog admin URL.

Interestingly, there is another closely related function called admin_url() which returns the admin URL of the current blog only. The difference between the two is that you can’t specify a blog ID with this function.

If you only need to get the admin URL of the current blog (as I did) then you can use either function with no parameters, and they will both return exactly the same result. It’s just a matter of preference.

Looking through the /wp-includes/link-template.php file I noticed that there were a few other new functions added to WorPress 3.0 for returning WordPress links.

Here is a quick summary (including links to the source code) of all the new link related functions in link-template.php:


Contributing to WordPress Core

There are many ways to contribute to WordPress such as adding to the Codex documentation, participating in the support forums, testing, bug reports and so on.. But for programmers, such as myself, there is nothing more satisfying than being able to contribute to the WordPress core code. The way the WordPress development process is structured allows for anyone with decent PHP programming skills to have a go at tackling some WordPress coding. Just download the latest beta and start coding! Read More