Without going into each of the products pages and setting sidebar to appear on left, how can I code it into the woocomerce product single page using php? http://www.mabridalplus.com/?product_cat=bridal-wear

Recommended Answers

All 4 Replies

In your html change the place of sidebar div with woocomerce-container div,
make these changes:

<div class="avada-row" style="">

    <div id="sidebar" style="float:left;"></div>
    <div class="woocommerce-container" style="position: relative; margin-left: 24%; margin-right: 0px"></div>
</div>

I put inline style, but you put it in css file.

sorry how do I translate that to css? I know avada had a place where I can put custom css which I do.

do I just add

#sidebar {float:left}

.woocommerce-container {position:relative; margin-left:24%; margin-right:0px;}

I also found an article on woocomerce itself regarding incompatibility with themes
http://docs.woothemes.com/document/third-party-custom-theme-compatibility/

Isn't there a way to just declare in functions.php that all pages whether woo commerce or regular theme pages has a siderbar that floats left by default?

I got it working I had to download all files and do a find and replace in dreamweaver for anything that said sidebar rigth to sidebar left and anything that say content left to content right

Add following code script in your theme’s functions.php file:

 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_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;
commented: meh... thread already solved 4 years ago without spammy links -1
commented: This falls into the don't spam category. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.