[wp-hackers] Plugin port to WP2.0

Arne Brachhold himself at arnebrachhold.de
Sun Jan 8 18:37:14 GMT 2006


> I was wondering if I want to use the new AJAX functionality in the  
> new wordpress, I am talking about the expandable "advance" options  
> like "Optional Excerpt" and "Trackbacks" in my own plugin what do I  
> need to add?

first of all you need to include the Javascript stuff, which isn't 
available on all pages by default. Maybe it wasn't intended that 
plugins use this functionality?

<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>

After that you have to create a DBX manager, which handles and 
saves the state (closed/open) of the parts. The dbxGroup object
contains all settings and the ID of the container which contains
the parts.

<script type="text/javascript">
    addLoadEvent( function() {
        var manager = new dbxManager('unique_id_for_your_plugin'); //session ID [/-_a-zA-Z0-9/]

        var your_plugin_group = new dbxGroup(
        'id_of_your_container', // container ID [/-_a-zA-Z0-9/]
        'vertical', // orientation ['vertical'|'horizontal']
        '10', // drag threshold ['n' pixels]
        'yes', // restrict drag movement to container axis ['yes'|'no']
        '10', // animate re-ordering [frames per transition, or '0' for no effect]
        'yes', // include open/close toggle buttons ['yes'|'no']
        'closed', // default state ['open'|'closed']
        'open', // word for "open", as in "open this box"
        'close', // word for "close", as in "close this box"
        'click-down and drag to move this box', // sentence for "move this box" by mouse
        'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse
        'use the arrow keys to move this box', // sentence for "move this box" by keyboard
        ', or press the enter key to %toggle% it', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
        '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts

Note that you have to give some elements the right IDs for
the correct look (blue background, the + and - signs etc).
The parent container element of your group must have
"advancedstuff" as the ID for example, because the styles
are hard coded for these elements IDs :(

Maybe this could be changed in future releases to generic
class names?

Best regards,


More information about the wp-hackers mailing list