On Mon, Apr 20, 2009 at 3:46 PM, John Turner <Turne...@cofc.edu> wrote: > I need a way to programmatically activate widgets, anyone know the function > or method to call?
I think that the activated widgets are stored in the database, in the * prefix*_options table. I dun remember where exactly but I'm going to tell you when I find it.
On Mon, Apr 20, 2009 at 4:17 PM, Simon Wheatley <si...@sweetinteraction.com>wrote:
> I think that the activated widgets are stored in the database, in the * > prefix*_options table. I dun remember where exactly but I'm going to tell > you when I find it.
> On Mon, Apr 20, 2009 at 4:17 PM, Simon Wheatley > <si...@sweetinteraction.com>wrote:
>> On Mon, Apr 20, 2009 at 1:46 PM, John Turner <Turne...@cofc.edu> wrote:
>>> I need a way to programmatically activate widgets, anyone know the >> function >>> or method to call?
>> The K2 theme has a sidebar management page, you might get some clues >> from there perhaps?
<?php // Debug: Makes sure no widgets are registered already. If so, be gone. //update_option( 'sidebars_widgets', NULL );
$current_theme = get_option( 'template' ); // variable stores the current theme $target_theme = 'wpframework'; // variable stores the theme we want to target $debug = false; // skip the ladie, da.
/** * $preset_widgets: * A two-dimensional array that stores all active sidebars and their active widgets * * Qiktip: Sidebars and widgets are identified by their unique ID */ $preset_widgets = array ( 'sidebar-1' => array( 'search', 'pages' ) );
// this checks to see if the user is trying to change themes, if so, // compare that theme with our target theme. if ( isset( $_GET['activated'] ) && $current_theme == $target_theme || $debug ) { update_option( 'sidebars_widgets', $preset_widgets );
}
// Debug: What widgets/widget areas are active? // Uncomment the next line and find out for yourself buddy ;P //var_dump( get_option( 'sidebars_widgets' ) ); ?>
> > I think that the activated widgets are stored in the database, in the * > > prefix*_options table. I dun remember where exactly but I'm going to tell > > you when I find it.
> > On Mon, Apr 20, 2009 at 4:17 PM, Simon Wheatley > > <si...@sweetinteraction.com>wrote:
> >> On Mon, Apr 20, 2009 at 1:46 PM, John Turner <Turne...@cofc.edu> wrote:
> >>> I need a way to programmatically activate widgets, anyone know the > >> function > >>> or method to call?
> >> The K2 theme has a sidebar management page, you might get some clues > >> from there perhaps?