• Resolved MiWo

    (@miwo)


    Good evening everyone,
    i have a problem with Customizr and (not only) Woocommerce..

    In Customizr i select left side sidebar as default for pages and posts. But i want to override this for woocommerce and set it to the right side.. nevertheless my selection is completly ignored. Just the left sidebar is shown.

    My question:

    How can i “force” to set it for woocommerce for the right side, maybe in functions.php?

    With woocommerce i mean everything, also the product pages..

    2nd Question.. how can i change the behaviour for individual categories?

    Thanks in advance

    Mirko

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can use something like this in your child-theme functions.php
    (woocommerce):

    // change layout for woocommerce shop or product category
    add_action('__before_article_container', 'woocommerce_shop_layout');
    function woocommerce_shop_layout(){
    
      if ( ! ( function_exists('is_woocommerce') && is_woocommerce() ) )
          return;
    
      add_filter('__screen_layout', 'my_ws_layout', 40, 2);
      function my_ws_layout($layout, $sidebar_class){
        $global_layout = TC_init::$instance -> global_layout;
        $my_layout = 'f'; // can be 'f' => full, 'b' => both sidebars, 'l'=> left , 'r' => right;
        if ( $sidebar_class == 'class'){
          return $global_layout[$my_layout]['content'];
        }
        return $my_layout;
      }
    }

    Similar things with categories using conditional tags:
    https://codex.ww.wp.xz.cn/Function_Reference/is_category

    Hope this helps.

    Thread Starter MiWo

    (@miwo)

    Wohooo, thanks d4z_c0nf works perfectly!
    Didn’t get the right filter.

    Because that is one of the tricky filters in Customizr 😀

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Sidebar in Woocommerce’ is closed to new replies.