This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Set default setting to false on start (built into a theme)

8 years ago · Last reply by Alex S 8 years ago

I am including the plugin as a recommended plugin and want to control some default settings from my theme.

I do not want the widgets shown that need to be downloaded. Also don’t want the content to be put into the siteorigin widget either, I have my own widgets so dont want these shown. I need to set the recommended widgets to false. I am trying to use this code in my theme functions but its not doesn’t work…

function every_plugin_page() {
	if( class_exists( 'Page Builder by SiteOrigin' ) ) {
		//if ( is_plugin_active( 'siteorigin-panels/siteorigin-panels.php' ) ) {
		
		function forcefully_recommended_widgets() {
			$settings = siteorigin_panels_setting();

			if ( ! siteorigin_panels_setting( 'recommended-widgets' ) ) {
				SiteOrigin_Panels_Settings::single()->set( 'recommended-widgets', false );
			}
		}
		add_action( 'wp', 'forcefully_recommended_widgets', 99);
	}
}

add_action( 'plugins_loaded', 'every_plugin_page' );

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

1
  1. Alex S Staff 8 years, 11 months ago

    Hi Jason,

    “Page Builder by SiteOrigin” isn’t a valid class. I would instead check for the siteorigin_panels_render function or the SiteOrigin_Panels_Settings class you’re trying to adjust.

    You’ll also need to run a few filters:

    siteorigin_panels_contextual_default_widgets (this is the widgets added to the contextual menu)

    siteorigin_panels_widgets This filter is a list of the widgets present. You need to unset SiteOrigin_Widget_Editor_Widget so that the defautl WordPress text editor is used.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread