Posts Tagged ‘more fields’

Locale dependent actions in WordPress

Wednesday, April 2nd, 2008

For some reason or other there are actions in WordPress that have translatable fields in them, so when these actions are used on other languages than English, they change. They are actions involving the $page_hook variable., e.g. admin_head-$page_hook. I ran into this problem when updating More Fields. The problem in the context of plugins is that the language is not loaded when the plugins are loaded, so that the needed translation is not available. To get around this, the actions requiring translation are called at the ‘admin_init’ action instead.

function mf_pre_queue_js () {
    add_action('load-' . sanitize_title(__('Settings')) . '_page_more-fields', 'mf_queue_js');
}
add_action('admin_init', 'mf_pre_queue_js');

I got help with this on the wp-hackers mailng list - a great source for WordPress insights.

>Try adding your actions on the init hook, I think that runs after
>the translatable stuff has been loaded and setup.

Correct.

Everything related to languages should be done at init or later, so that everything is loaded and any plugins that modify the content are loaded.

So, at the init/admin_init hook, we’re safe to assume that the appropriate language has been loaded.

More Fields version 0.6

Monday, March 31st, 2008

I’ve just updated More Fields to version 0.6, compatible with WordPress 2.5.

New features:

  • Compatible with the new admin introduced in WordPress 2.5
  • Set default value in a select list.
  • Enable right hand column boxes in WP 2.5.
  • Option of removing the ‘Related’ links on the right hand side on the Write/Edit page.
  • A new set of actions, enabling users to change the behavior of More Fields. The documentation has been updated to include an example on how to use these actions.

The plugin can be downloaded from wordpress.org.

Any feedback is always greatly appreciated.

We release the ‘More Fields’ Wordpress plugin!

Thursday, January 10th, 2008

Finally, having uhhmm’d and ahhrree’d about implementation, I’ve decided submit the 0.4 beta version of the ‘More Fields’ plugin to the Wordpress Plugins CVS server, else it might never happen.

You can find more information about the plugin here. I’m hoping to update the examples to reflect the current look of the plugin, albeit I’m still hoping for a redesign of the ‘More Fields’ admin for some future version.

You can download the plugin from Wordpress.org.

The plugin is a beta, which means it might be riddled with bugs and oddities that might sink your particular Wordpress ship. It is released under the GPL license.

As always, feedback and comments are always very much appreciated.

I’m quite exited to see this one out the door. There are another two proprietary plugins that we currently run on dagensskiva.com - one that handles the external links associated with posts, and one (sizable) ad-management system. I’m hoping that these will also be released shortly.