Register Default Settings

If you are using MashShare in your theme you likely want to use default settings and do not want your customer to fiddle around with hundreds of MashShare settings. Below you find a few documented sample settings which you can use in your theme. You find all available MashShare settings in the file /includes/admin/register-settings.php
/**
 * Set default option values for fresh MashShare plugin installations.
 */
function prefix_mashshare_set_defaults() {
	$settings = get_option( 'mashsb_settings', array() );
	// Skip if already set.
	if ( ! empty( $settings ) ) {
		return;
	}
	$defaults = array(
		'mashsharer_cache'    => '21600', // 6 hours.
		'hide_sharecount'     => '1',
		'mashsharer_round'    => '1',
		'subscribe_behavior'  => 'link',
		'mashsharer_position' => 'both',
		'post_types'          => array(
			'post' => 'post',
		),
		'visible_services'    => '1',
		'networks'            => array(
			// Facebook.
			array(
				'id'     => 'facebook',
				'status' => '1',
				'name'   => '',
			),
			// Twitter.
			array(
				'id'     => 'twitter',
				'status' => '1',
				'name'   => '',
			),
			// Subscribe.
			array(
				'id'     => 'subscribe',
				'status' => '1',
				'name'   => '',
			),
			// Pinterest.
			array(
				'id'     => 'pinterest',
				'status' => '1',
				'name'   => '',
			),
			// Google.
			array(
				'id'     => 'google',
				'status' => '1',
				'name'   => '',
			),
		),
	);
	update_option( 'mashsb_settings', $defaults );
}

Still need help? Contact Us Contact Us