Populate sidebar with widgets in php code
-
Hey guys. I’ve hit an epic roadblock and I’m beginning to go crazy.
Is there a way to populate a sidebar with available widgets. So for example, say if I create a new custom sidebar and I want to auto populate it with a set of widgets (ie. text, tag_cloud).
I’ve been trying to trace the steps by looking through the admin-ajax.php and rewriting the code in a plugin. Basically mimicing the ajax calls that are done from the widgets page.
I hit a wall when I’m trying to access the global variables like:
$wp_registered_widget_updates
$wp_registered_sidebars
$sidebars_widgets
$wp_registered_widgetsProblem is they’re all empty! However when using ajax they are set. I’ve tried including all files and including all actions that the admin-ajax runs and with no success.
Any help or direction on how to do this would help. Thanks!
- The topic ‘Populate sidebar with widgets in php code’ is closed to new replies.