• Hey there,

    I have the oceanwp theme and I installed a plug-in that creates posts for me (custom post type) and it displays the sidebar. I did everything I could and chose full width for both the general page layout and also for the blog section but it didn’t change anything at all.

    I also tried to place the code:

    /**
    * Alter your post layouts
    *
    * Replace is_singular( ‘post’ ) by the function where you want to alter the layout
    * @return full-width, full-screen, left-sidebar or right-sidebar
    *
    */
    function my_post_layout_class( $class ) {

    // Alter your layout
    if ( is_singular( ‘post’ ) ) {
    $class = ‘full-width’;
    }

    // Return correct class
    return $class;

    }
    add_filter( ‘ocean_post_layout_class’, ‘my_post_layout_class’, 20 );

    in the functions.php file and that didn’t do anything also!

    Any thoughts? Thanks.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • AddWeb Solution

    (@addweb-solution-pvt-ltd)

    hello @adrianvnunez,

    try the below code in your functions.php.

    function my_post_layout_class( $class ) {
    
    	// Alter your layout
    	if ( is_singular( 'sfwd-topic' )
    		|| is_singular( 'sfwd-lesson' )
    		|| is_singular( 'sfwd-quiz' ) ) {
    		$class = 'full-width';
    	}
    
    	// Return correct class
    	return $class;
    
    }
    add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );

    hope this will help you,
    thanks.

    Hello,

    Try to remove the code if you have added any to change the layout.
    For the blog post and archive pages, go to Customize > Blog > Entry and Single Post section – select full-width layout.
    For the custom post types, add the below code to the functions.php file of the child theme. Replace the ‘your-cpt-name’ with your custom post type name –

    function my_post_layout_class( $class ) {
           if ( is_singular( 'your-cpt-name' ) ) {
           $class = 'full-width';
           }
           return $class;
    }
    add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );

    I also replied to your ticket on oceanwp support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot Remove Side Bar On Custom Post Types & Blogs’ is closed to new replies.