Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Hello SO Team.
Please is there a way to programmatically activate some default widgets?
I tried
SiteOrigin_Widgets_Bundle::single()->activate_widget('sow-features')and even thisfunction mytheme_activate_wb_widget( $widgets ) {
$widgets[] = 'sow-features';
return $widgets;
}
add_filter('siteorigin_widgets_active_widgets', 'mytheme_activate_widget')I put the code above in my functions.php and even tried it in a plugin.
Thanks.
Hi Dave,
I’d like to help you with this issue. Unfortunately, this is beyond the scope of the support we’re able to offer on our free forums. There is a fair amount of custom work involved.
We do offer this level of support to our premium users, so if you’d like to upgrade to SiteOrigin Premium, then I can help you over email support.
If you’d prefer not to upgrade to SiteOrigin Premium, then you can hire a WordPress developer from Codeable. They’ll charge you an hourly rate for any work done.
Thanks Alex.
I am a WordPress Developer so I don’t need to hire a developer from Codeable. This worked for me
$folder = WP_PLUGIN_DIR . '/so-widgets-bundle/widgets/'; $widget_ids = array('testimonial'); //you can add more foreach ($widget_ids as $widget_id) { if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue; // There are times when we activate several widgets at once, so clear the cache. wp_cache_delete( 'siteorigin_widgets_active', 'options' ); $active_widgets = SiteOrigin_Widgets_Bundle::single()->get_active_widgets(); $active_widgets[$widget_id] = true; update_option( 'siteorigin_widgets_active', $active_widgets ); wp_cache_delete( 'active_widgets', 'siteorigin_widgets' ); }