If you are working with OceanWP and want to remove the sidebar from a custom post type it can be a little tricky. Luckily there is a simple snippet that just needs to be added to your functions.php file that will take care of this. You can use this to remvoe the sidebar from a custom post type archive page, single post page and taxonomy archive page. The result will be a full width page (not 100% full width).

// Remove the OceanWP sidebar from the custom post type called "demo"
function remove_sidebar_post_type_archive( $class ) {
	if ( is_singular( array('demo') ) || is_post_type_archive( array('demo') ) ||is_tax(array('demo') )) {
	$class = 'full-width';
	}
return $class;
}
add_filter( 'ocean_post_layout_class', 'remove_sidebar_post_type_archive', 20 );

Leave a Reply

Get in Touch

Please fill out the form below and we will get back to you ASAP

  • This field is for validation purposes and should be left unchanged.