I have a site with several post types, the public can add content to them via a frontend, so no access to the backend.
Depending on the posttype I would like to show either no sidebars, one sidebar or two sidebar.
For me to go into every entry to set the settings according to that posttype after some added data is a bit of a headache. Is there a way to set on a post type basis the layout required.
add_filter( 'generate_sidebar_layout','generate_custom_post_type_sidebar_layout' );
function generate_custom_post_type_sidebar_layout( $layout )
{
// Get post type
$type = get_post_type();
// If our post type is named "my_post_type", set the sidebar
if ( 'my_post_type' == $type )
return 'both-left';
// If our post type is named "recipes", set the sidebar
if ( 'recipes' == $type )
return 'left-sidebar';
// Or else, set the regular layout
return $layout;
}