Support » Plugin: Livemesh SiteOrigin Widgets » Autoactivate widget after plugin activation

  • Resolved webvd

    (@webvd)


    Hi,

    I’m using your plugin in my theme and would like to activate the testimonal slider widget after the plugin is installed and activated by default. I use the code underneath but for some reason the whole WordPress installation gets broken after the plugin is activated. Also, I first have to click next in the box that appears for live connection. When I put back the code after this the activation works.

    Any idea how to pass this or how to see if this boxed is passed and then let the code does his thing?

    /**
     * Activate Siteorigin Livemesh widget after import
     */
    
    if ( is_plugin_active( 'livemesh-siteorigin-widgets/livemesh-siteorigin-widgets.php' ) ) {
    
    $folder = WP_PLUGIN_DIR . '/livemesh-siteorigin-widgets/includes/widgets/';
    $widget_ids = array('lsow-testimonials-slider-widget');
    foreach ($widget_ids as $widget_id) {
    
    	if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
    
    		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' );
    }
    
    } 

    Overall such a nice plugin.
    Regards 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author livemesh

    (@livemesh)

    Can you pls post this in the siteorigin widgets bundle forum or the community forum at siteorigin.com? I am not fully aware of how the widgets bundle works internally and they should be able to help quicker than we are able to. Thank you!

    I will, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.