Snippet: Only Show Staff Settings in the Theme Settings Metabox
Important: It's now recommended to keep the Theme Settings metabox disabled in the Theme Panel. When the Theme Settings metabox is disabled it will still display the post type specific settings, so it will accomplish the same thing as the snippet below.
By default the Total theme displays a "Theme Settings" metabox on all core public post types which includes various settings to modify the post on independently. This meta box can be disabled completely via the Theme Panel but it can also be modified via custom code. This snippet shows how you can modify the Theme Settings so when editing a staff post it will only display the staff settings and not all the other general settings.
/**
* Modify the Theme Settings metabox to display only the Staff settings when editing a staff post.
*/
add_filter( 'wpex_metabox_array', function( $settings, $post_type ) {
if ( 'staff' === $post_type && isset( $settings['staff'] ) {
$settings = [
$settings['staff'],
];
}
return $settings;
}, 10, 2 );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
We recommend Code Snippets (100% Free) or WPCode (sponsored)