Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1200640
    Simon
    Participant

    Hi X-Team !

    I try to display left sidebar on the single product page.

    I have find this and it’s work find :

    
    if ( ! function_exists( 'x_get_content_layout' ) ) :
      function x_get_content_layout() {
    
        $stack          = x_get_stack();
        $content_layout = x_get_option( 'x_' . $stack . '_layout_content', 'content-sidebar' );
    
        if ( $content_layout != 'full-width' ) {
          if ( is_home() ) {
            $opt    = x_get_option( 'x_blog_layout', 'sidebar' );
            $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() || x_is_product() ) {
              $opt    = x_get_option( 'x_woocommerce_shop_layout_content', 'sidebar' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            } else {
              $opt    = x_get_option( 'x_archive_layout', 'sidebar' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            }
          } elseif ( x_is_bbpress() ) {
            $opt    = x_get_option( 'x_bbpress_layout_content', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( x_is_buddypress() ) {
            $opt    = x_get_option( 'x_buddypress_layout_content', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_404() ) {
            $layout = 'full-width';
          } else {
            $layout = $content_layout;
          }
        } else {
          $layout = $content_layout;
        }
    
        return $layout;
    
      }
    endif;

    I have also add this for display the sidebar on the left.
    But my home-page is totaly unorganized

    @media only screen and (min-width: 980px) {
    
    .x-main {
      float: right !important;
    }
    
    .x-sidebar {
      float: left !important;
    }
    }

    I just want the same sidebar that products page on the single product.
    Just want a sidebar on left of my single product page.
    I need some help… 🙂

    #1200652
    Simon
    Participant
    This reply has been marked as private.
    #1200873
    Nabeel A
    Moderator

    Hi there,

    Thanks for writing in! Please add the following code in your Customizer via Appearance > Customize > Custom > Edit Global CSS:

    .x-sidebar {
        float: left !important;
    }
    .x-main {
        float: right !important;
    }

    On your homepage you don’t have a sidebar that’s why the above code doesn’t work on your homepage.

    Let us know how this goes!

    #1200889
    Simon
    Participant

    Hi Nabeel,

    Maybe I do not have a sidebar on the home page but these css totally deconstruct my homepage.
    By blowing my background and with the float right of my content. Css conflict i think.

    Simon

    #1200892
    Simon
    Participant

    screenshot

    #1201096
    Nabeel A
    Moderator

    Hi again,

    You can replace the previous code with this one:

    @media screen and (min-width: 980px){
    body:not(.home) .x-main {
        float: right !important;
    }
    body:not(.home) .x-sidebar {
        float: left !important;
    }
    }

    Hope this helps!

    #1201587
    Simon
    Participant

    Nabeel,

    You’r the best ! 🙂

    Big thanks !

    #1201674
    Friech
    Moderator

    We’re delighted to assist you with this.

    Cheers!

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