[wp-hackers] how to do a single-instance widget with the new API
Raphaël Droz
raphael.droz at gmail.com
Wed Mar 17 16:59:43 UTC 2010
Hi,
I've just done my first widget using the new API.
The abundance of documentation helped a lot anyway I'm now blocked by
what, at a first look, didn't seem a huge issue but ...
This widget uses jquery to request the server asynchronously.
On the server side, in my widget/plugin directory I have an action.php
which :
define('DOING_AJAX', true);
include('../../../wp-config.php');
include(WP_CONTENT_DIR . '/../wp-admin/includes/admin.php');
# then sends the answer.
The problem is that get_option('widget_wpsympa'); returns nested arrays
of the (possibly) several instances of the widget while it's aimed to be
unique.
Should I forget about the new widget API ?
Should I wait for a WP 3 new option in $widget_ops ?
Or is there a way to obtain the specific instance calling in action.php ?
Thank you for your answers.
Raph
More information about the wp-hackers
mailing list