|

Change default mockup project options

You can set default options for new mockup projects using the  ph_project_meta_box_options filter. This will let you set specific defaults for projects when you create new mockup projects. This will not affect your existing projects, only defaults for newly created mockup projects.

Here’s how you’d set those defaults with a filter. You’ll likely add this to your theme or child theme’s functions.php file and modify the ‘on’ or ‘off’, and ‘public’ values as necessary:

<?php
/**
 * Set defaults for new mockup projects
 *
 * @param $options array Meta box options
 *
 * @return array Filtered options
 */
function wp_928_mockup_project_defaults( $options ) {
	foreach ( $options as $key => $option ) {
		switch ( $option['id'] ) {
			case 'project_access':
				$options[ $key ]['default'] = 'public'; // login, password or public
				break;
			case 'project_comments':
				$options[ $key ]['default'] = 'on'; // on or off
				break;
			case 'project_sharing':
				$options[ $key ]['default'] = 'on'; // on or off
				break;
			case 'retina':
				$options[ $key ]['default'] = 'on'; // on or off
				break;
			case 'project_download':
				$options[ $key ]['default'] = 'on'; // on or off
				break;
			case 'zoom':
				$options[ $key ]['default'] = 'on'; // on or off
				break;
			case 'project_approval':
				$options[ $key ]['default'] = 'on'; // on or off
				break;
			case 'project_unapproval':
				$options[ $key ]['default'] = 'on'; // on or off
				break;
		}
	}

	return $options;
}

add_action( 'ph_project_meta_box_options', 'wp_928_mockup_project_defaults' );
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page
Scroll to Top