In: On: 2008 / 03 / 11 Short URL: http://ozh.in/h4

WordPress 2.5, initially due today, has been delayed by a week. There a number of people complaining about this, and I really don't get why. I am personally much happier with a more stable release than with something that ships with bugs because someone pushed the "Go gold!" button too fast.

Official release date of WordPress 2.5 is 03/17/08, but you could interpret this by "Real Soon & When It's Done" as well. Plus, it gives me a few more days to update a few plugins :)

In: , On: 2008 / 03 / 11 Short URL: http://ozh.in/h3

WordPress 2.5 basically breaking every plugin that was messing with the admin area, I have a number of plugin to update. My favorite one, Admin Drop Down Menu, is now fully compatible with the next blue thing (aka WP 2.5), but the other ones are still to be updated:

  • A fix for Absolute Comments is under way (but boy, I practically need to rewrite everything from scratch)
  • Who Sees Ads should look rather ugly but should still work fine. Anyway, a fix is under way, too.
  • I have a number of updates to publish for my other plugins, related or not with WordPress 2.5 being released. Everything is, errrm… under way :)

In other words: no need to mail or drop comments about things being odd or broken. I know this. Be patient! (Be indeed patient, I'm currently packing for skiing! \o/)

With WordPress 2.5 and its completely revamped admin interface coming out, the mother of all the Admin menus needed a lifting. So it got one!

The new Admin Drop Down Menu for WP2.5+

Version 2.0 of my popular Admin Drop Down Menu, for WordPress 2.5+ only, has been completely reworked. It now features vertical dropdown menus, which should be easier to click and which should behave more nicely with dozens of plugins each adding their own menu entry.

You will love it. Get it now!

Heh: The first rule of Wikipedia is exactly what you’re thinking if you have the slightest movie culture. Found via a funny Google query about first rules. Ho, by the way, the first rule of planetOzh is: You talk about planetOzh to everybody you know:) (1) «
I just found out something that some will find obvious: from the trunk page of the WordPress SVN repository (or WordPress Mu, or anything that uses Trac really) there’s a link at the very bottom of the page that will send you a fresh build in a zip archive. Handy for when you don’t have an SVN install to play with. (1) «

To add custom content to the "Write" admin pages (where you write posts, pages or links), WordPress 2.5 introduces a new function set: add_meta_box()

add_meta_box

Simple plugin example :

  1. <?php
  2. /*
  3. Plugin Name: Example: Add Meta Box
  4. Plugin URI: #
  5. Description: Simple example showing how to add a "meta box" in WP 2.5
  6. Version: 0.0
  7. Author: Ozh
  8. Author URI: http://planetozh.com/blog/
  9. */
  10.  
  11. // This function tells WP to add a new "meta box"
  12. function add_some_box() {
  13.     add_meta_box(
  14.         'ozh', // id of the <div> we'll add
  15.         'My Box', //title
  16.         'add_something_in_the_box', // callback function that will echo the box content
  17.         'post' // where to add the box: on "post", "page", or "link" page
  18.     );
  19. }
  20.  
  21. // This function echoes the content of our meta box
  22. function add_something_in_the_box() {
  23.     echo "I'm living in a box";
  24. }
  25.  
  26. // Hook things in, late enough so that add_meta_box() is defined
  27. if (is_admin())
  28.     add_action('admin_menu', 'add_some_box');
  29.  
  30. ?>

The catch here is to hook the function that add our "meta box" (here: add_some_box()) late enough so that the function it needs, add_meta_box(), has been defined. Hooking on 'admin_menu' is fine.

If you want something compatible with both WordPress 2.3 and 2.5, you will need something like the following:

  1. if (function_exists('add_meta_box') {
  2.     // 2.5 style
  3. } else {
  4.     // 2.3
  5. }

Migrating Plugins from 2.3 to 2.5. WordPress coders, get prepared for the upcoming 2.5 (to be released on March 10th). Themes shouldn't be affected by the new features and code, but plugins messing with the admin area will probably need a rework.

In: , , On: 2008 / 02 / 14 Short URL: http://ozh.in/gx

I finally got an iPod Nano 3G (after much pondering) and it's, well, ok. Stunning device with awesome usability, but pathetic software and missing some key features. Every time I listen to music, I love my iPod. Every time I manage my MP3 collection, I hate it (even after I got rid of the hapless iTunes and installed Floola instead, which is much much better)

Anyway, tonight my iPod crashed, while I was refueling the battery. Screen lit, no matter what button I pressed it wouldn't do anything. And there's no hard reset button :) So?

Solution 1 : wait for the battery to die. Might be long if you've just recharged the battery.

Solution 2 : press Menu, hold and press the center button. Keep pressing both buttons for about 10 seconds, the iPod suddenly reboots. Yay \o/

In: On: 2008 / 02 / 14 Short URL: http://ozh.in/gw

If you don't have an SVN install to play with next WordPress version (the upcoming 2.5 milestone), someone is here to help. Chris Johnston has set up a WP 2.5 demo site so you can log in the admin area and see what's changing in there. New colors, new look, new menus, new interface: this version will bring a lot of visual changes in the backend.

WordPress 2.5 Preview

Log in with admin / demo as a username / password combination, and play around. Don't be afraid of breaking thing, everything is reverted to a fresh empty install every hour or so.

  1. query_posts($query_string.'posts_per_page=-1');
  2.        while(have_posts()) {
  3.        the_post();
  4.        the_time();
  5.        the_title();
  6. }

This will display the time and title for all your posts. This could result in a very long page, and a more usable way of doing it would be to change the posts_per_page parameter, and add Next and Previous links to navigate the whole list. Code snippet by Otto in the wp-hackers mailing list.