Sidebar issues and CSS

I am trying to remove the sidebar from blog post and portfolio pages. It was not there in the past but is appearing now. I have set the layout to full width and set to use global settings. I tried adding some CSS code from another support request and it did not work. I have removed it but now the menu CSS is having issues.

Could you help me out?

Hi,

To make it full width, you can add the code below in your child theme’s functions.php file.

  function x_get_content_layout() {
    $content_layout = x_get_option( 'x_layout_content' );
    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $layout = 'full-width';
      } elseif ( x_is_portfolio_item() ) {
        $layout = 'full-width';
      } elseif ( x_is_portfolio() ) {
        $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
        $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
      } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
        $layout = 'content-sidebar';
      } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
        $layout = 'sidebar-content';
      } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
        $layout = 'full-width';
      } elseif ( is_archive() ) {
        if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
          $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        } else {
          $opt    = x_get_option( 'x_archive_layout' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        }
      } elseif ( x_is_product() ) {
        $layout = 'full-width';
      } elseif ( x_is_bbpress() ) {
        $opt    = x_get_option( 'x_bbpress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( x_is_buddypress() ) {
        $opt    = x_get_option( 'x_buddypress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_404() ) {
        $layout = 'full-width';
      } else {
        $layout = $content_layout;
      }
    } else {
      $layout = $content_layout;
    }
    return $layout;
  }

Hope that helps

So I ftp’d into the site and added the code to the functions.php file and re-uploaded it. That worked for the post section but not for the portfolio pages. I use to not have this issue and it use to take the settings from the theme customization - it started happening after an update.

Thoughts on what to do next?

I see that in fact the problem did not go away but instead I was using custom CSS with the pages there were working

.x-portfolio .entry-info {
width: 100%;
}

.x-portfolio .entry-extra {
width: 100%;
margin-top: 10px;
}

So that works also.

Hi There,

You can make your individual posts fullwidth by setting the Layout and Design > Content Layout to Fullwidth, maybe you did change this, that is why your posts are now showing a sidebar.

The option that you have on the Blog > Layout is only for the Blog index page and Archive pages.

The widget area that on the side of Portfolio pages is not a sidebar. Its been always there unless you hide it with a custom CSS or you did turn off all of its social share icon from Customizer > Portfolio.

You can hide that area again with this Custom CSS.

.x-portfolio .entry-info {
	width: 100%;
}

.x-portfolio .entry-extra {
	display: none;
}

Hope this helps,
Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.