[wp-hackers] Codex on 2.5 plugin/theme migration...

Jennifer Hodgdon yahgrp at poplarware.com
Fri Feb 15 00:18:48 GMT 2008


Ryan Boren wrote:

>>  - Plugins are activated in a non-global scope, so you may have to add
>>  a couple of 'global' declarations to your plugin to get the activation
>>  to work.
> 
> We can register some common globals within activate_plugin() and in
> includes files where they are used outside of a function such as
> schema.php.

$wpdb would be the obvious choice. I also had to globalize a couple of 
plugin-specific variables.

>>  - Format/markup of the post edit screen has changed, so if your plugin
>>  adds sections to this screen, it needs to do it differently.
> 
> Could do something like this:
> if (function_exists(add_meta_box()) {
>   // 2.5 style
> } else {
>   // 2.3
> }


Oh, I didn't see the add_meta_box function. I just followed what the 
other "advanced" edit sections on the default edit page were doing, 
and checked for the existence of the postbox_classes function as a 
clue that the new formatting should be used, within the 
dbx_post_advanced action function I already had in the plugin.

Where does add_meta_box add its box, anyway?

     --Jennifer

-- 
Jennifer Hodgdon * Poplar ProductivityWare
    www.poplarware.com

Drupal/WordPress Sites, Themes, Modules/Plugins
  Custom Web Programming, Web Databases
   Modeling/Analysis/Palm OS Software



More information about the wp-hackers mailing list