Sidebars not appearing

Hi there, I am trying to use sidebars on specific pages, and cant get them to work. I have created the sidebar, added widgets to it, and associated it to the pages I want them to appear on and even changed the layout of hte page to ‘content left, sidebar right’. But that does nothing. Could you help?

Hey @ramnathk,

You need to set Content Layout in theme options. Browse to PRO >> Launch >> Theme Options >> Layout and Design >> Content layout and select layout with sidebar

Once you set content layout your default page template adopt the same layout. For the full-screen layout for particular page you need to select Layout - Full width.

Hope this helps.

Regards

Thanks Rahul, I had 2 follow on questions

  1. Most/All pages are fullwidth, so leaving that as the default is efficient while creating regular pages. That is why I had left the content layout to fullwidth. So, can I not change it just for pages that need a sidebar?
  2. A less significant question is: your screen shot shows the content layout selection as a drop-down, whereas on for me it is a list of radio buttons as shown in this image. Whats different?

Hello There,

Thanks for updating in!

1.) To resolve your issue, since your child theme is set up, please add the following code in your child theme’s functions.php file

// Custom content layout
// =============================================================================
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' ) ) {
      $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
      $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
    } 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 {

    if ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
      $layout = 'content-sidebar';
    } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
      $layout = 'sidebar-content';
    } else {
      $layout = $content_layout;
    }
  }
  
  return $layout;


}
// =============================================================================

2.) The screenshot is taken from X > Launch > Layout and Design. Your screenshot was taken from the customizer, Appearance > Customize > Layout & Design

Hope this helps. Please let us know how it goes.

Nice, definitely saves time on the UI… thanks.

You’re welcome.

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