- Dialog Display On User Image Approval
- Changing A Mockup URL Slug
- Extend Backbone Models, Views, Collections
- Custom Scripts & Styles
- Website Publish Action
- New Comment Threads
- Additional Notification Emails
- Welcome Message In Mockups
- Change Subscribed User Email
- Dialog Display After A Comment
- Auto-Close Mockup Comment
- Changing Mockup Download
- Add Settngs To Extension Page
- Listening JavaScript Events
- Modify Default Mockup Project Options
- Overriding & Changing Templates
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.
On this page