Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1104804
    MykelMartin
    Participant

    Hi,

    i have created a normal page and assign the page template with sidebar. But it does not working.
    I have tried both left and right sidebar template. please check the below URL and let me know the issue

    http://demo.welovesellingrealestate.com/test/leftsidebar-testing/

    http://demo.welovesellingrealestate.com/test/rightsidebar-testing/

    #1105073
    Paul R
    Moderator

    Hi,

    Thanks for writing in!

    Please note that page template will not work if you have set your Content Layout to Full width under Layout and Design in the customizer.

    However you can try adding this 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' ) ) {
            $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';
          } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
            $layout = 'full-width';
          }
          $layout = $content_layout;
        }
    
        return $layout;
    
      }
    

    Hope that helps.

    #1106534
    MykelMartin
    Participant

    Hi,

    Thank you for your quick response.
    I have added the shared codes in the functions.php file under the child theme, but it does not work. Could you please let me know the issue.

    Also in the widget area, i need separate sidebar for these two template. So how can i set the different sidebar, please let me know. I have attached the widget area screenshot.

    #1106640
    Rue Nel
    Moderator

    Hello There,

    Thanks for providing the screenshots! As Paul mentioned in his reply, please make sure that you are not using the Layout – Fullwidth page template. To know more about page templates, please check it out here: https://community.theme.co/kb/page-templates/

    To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    To do this, you can make a post with the following info:
    – Link to your site

    – WordPress Admin username / password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thank you.

    #1108304
    MykelMartin
    Participant
    This reply has been marked as private.
    #1108439
    Rue Nel
    Moderator

    Hello There,

    If you want to display the page as fullwidth, no sidebar will appear because of course you want a fullwidth layout. This is what happen in your site. No sidebars are displaying because in the customizer, Appearance > Customize > Layout & Design > Content Layout you have set it to fullwidth. To override this setting, you’ll need to have a custom function added in your child theme’s functions.php file.

    Since you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.

    // Custom Page template 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;
    
    }
    // =============================================================================

    Before this code will take effect, please do clear your site cache since you maybe using CloudFlare over at your hosting panel.

    Please let us know how it goes.

    #1109930
    MykelMartin
    Participant

    Thank you for your help.
    It’s working.

    #1109931
    Christopher
    Moderator

    Glad we could help you with this.

  • <script> jQuery(function($){ $("#no-reply-1104804 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>