Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1154581
    marcooos
    Participant

    I want to add a sidebar with a menu (listing the categorys) on the category page on Woocommerce.

    Is this possible?

    #1154582
    marcooos
    Participant
    This reply has been marked as private.
    #1154652
    Christopher
    Moderator

    Hi there,

    To assign sidebar to archive pages, select taxonomies under Appearance -> Sidebar.

    Hope it helps.

    #1154954
    marcooos
    Participant

    Hey Christopher,

    I thought it was that easy, and I’ve already done that.

    But it’s not showing up 🙁

    #1155031
    Paul R
    Moderator

    Hi,

    To add sidebar, kindly add the code below in your child theme’s functions.php {wp-content/themes/x-child/functions.php}

    
    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 {
          $layout = $content_layout;
        }
         if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
             $layout = 'content-sidebar';
         }
        return $layout;
    
      }
    

    Hope that helps.

    #1156534
    marcooos
    Participant

    Hi Paul,

    I have added that code but it is not working still 🙁

    #1156575
    Rad
    Moderator

    Hi there,

    Please add the provided code to your child theme’s functions.php and not at style.css

    Thanks!

    #1156683
    marcooos
    Participant

    Yep, thats what I did. My login details are up top, you can log in and see for yourself.

    #1156716
    Paul R
    Moderator

    Hi,

    Upon checking, I can see you have added it in style.css and not in functions.php file.

    Please see screenshot – http://screencast.com/t/pW1bHPtz

    #1157956
    marcooos
    Participant

    1000 apologies! Its is working now.

    BUT now the default sidebar also shows on the shop index page, even though I have “enable sidebar on shop index page” unchecked.

    How do I fix this?

    #1158021
    Lely
    Moderator

    Hi There,

    If you don’t want the sidebar to show on the shop index page, please check the following part of the code suggested by Paul :

         if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
             $layout = 'content-sidebar';
         }

    Update to this:

         if (x_is_product_category() || x_is_product_tag() ) {
             $layout = 'content-sidebar';
         }

    Hope this helps.

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