Support » Theme: OceanWP » How to completely remove sidebar through editing child themes?

  • Resolved cryptotera789

    (@cryptotera789)


    Hi,

    I would like to completely remove the sidebar. I heard that I would need to edit theme files by using child theme. Can you please navigate me in doing this?

Viewing 15 replies - 1 through 15 (of 19 total)
  • Theme Author oceanwp

    (@oceanwp)

    Hello, you don’t need a child theme for this, you can directly go to the customizer settings, if you want to remove the sidebar for all your site, go tot he General Options > General Settings of the customizer and choose the full width or 100% full width layout, then if you have a blog, go to the Blog > Blog Entries and Single Post section to do the same thing.

    Thanks for the reply. However this solution did not work for me. When I go to General Options > General Settings, I do not see “full width or 100% full width layout” option. Instead I only see this: options
    Same thing for Blog, there is no such option. Once I increased Main Content Width to 100% and Sidebar to 0%, my sidebar just moved down the page and looks like this.

    Am I doing everything right?

    Theme Author oceanwp

    (@oceanwp)

    It is the images in the Layout setting, there is: right sidebar, left sidebar, full width, 100% full width and both sidebars layout.

    tollube

    (@tollube)

    Is it possible that this wont work for custom post types?

    Theme Author oceanwp

    (@oceanwp)

    Hello @tollube, yes, it works for all CPT, you just need to find the CPT function and you can change its layout.

    @oceanwp
    I really can’t find a way to remove it from my custom post type. In the customizer there is no option for custom post types.
    So where do I remove it?

    Theme Author oceanwp

    (@oceanwp)

    Hello @tollube, can you create a pre-purchase ticket on oceanwp.org? I will check this.
    Send me the login details of an admin and FTP account in the ticket.

    Hi,
    I just ran into this issue also, is there a solution for CPT page that shows the sidebar?

    Amit Singh

    (@apprimit)

    Hello,

    Follow the documentation to altering the layout of CPT – https://docs.oceanwp.org/article/203-altering-layouts

    So i just need to add this code to my Function.php file and the SIDEBAR will be disable completely?

    /**
    * 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 );

    @apprimit
    It worked, Thanks !
    But now i have another problem, even thoug thet page is set to 100% full width and the area in Elementor is set to Full width, i still see it as framed/boxed and not full width

    Here is a link:
    https://www.pikmediagroup.com/piki_shop/canva-tutorial/

    It seems you have set fullwidth only. Try to reset the layout to 100% full width from the OceanWP setting metabox of the page. It should work.

    It seems you are trying to remove the sidebar for the single post. Remove the code you have added. Now go to Customize > Blog > Single Post and select 100% full-width layout.

    • This reply was modified 7 months, 3 weeks ago by  Amit Singh.
    alkis12

    (@alkis12)

    What if we we have more than 1 post types?
    I have 2 post types (1 is topikes_koinothtes and the other is prokhr_diakhr)
    The below code is for 1 of the 2 but how do we add both types?

    /**
     * Alter your KOINOTHTES layouts
     *
     * Replace is_singular( 'topikes_koinothtes' ) 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( 'topikes_koinothtes' ) ) {
            $class = 'full-width';
        }
    
        // Return correct class
        return $class;
    
    }
    add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );
    
    Theme Author oceanwp

    (@oceanwp)

    Hello, add the code like this:

    function my_post_layout_class( $class ) {
    
        // Alter your layout
        if ( is_singular( 'topikes_koinothtes' ) ) {
            $class = 'full-width';
        }
    
        if ( is_singular( 'second_cpt' ) ) {
            $class = 'full-width';
        }
    
        // Return correct class
        return $class;
    
    }
    add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );
    
    alkis12

    (@alkis12)

    @oceanwp THANK YOU!!! 🙂

Viewing 15 replies - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.