Reply To: Different layouts for different custom post types

Home Forums Support Different layouts for different custom post types Reply To: Different layouts for different custom post types

#212227
Dhruv

Hello Tom,

Actually I wanted the sidebars on singular pages of custom post types.
So, I just changes the code from is_post_type_archives() to is_singular() and it is working now.

add_filter( 'generate_sidebar_layout','generate_custom_sidebar_layout' );
function generate_custom_sidebar_layout( $layout )
{
 	if ( is_singular( $post_types = 'download' ) )
 	 	return 'right-sidebar';

if ( is_singular( $post_types = 'notes' ) )
 	 	return 'left-sidebar';

	// Or else, set the regular layout
 	return $layout;

 }

Thanks for Guiding…This issue is resolved 🙂