Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1278439
    nextstepsyep
    Participant

    Greetings,

    I’ve tried to locate the proper code to add a sidebar to my full width product category pages to no avail. I managed to get the width perfect by adding

    .archive.woocommerce .x-main {
    width: 75%;
    }.archive.woocommerce .x-sidebar {
    width: 20%

    to my Custom CSS. Unfortunately, when I tried to update my wp_sidebar.php file with this code

    <?php

    // =============================================================================
    // VIEWS/INTEGRITY/WP-SIDEBAR.PHP
    // —————————————————————————–
    // Sidebar output for Integrity.
    // =============================================================================

    ?>

    <?php if ( x_get_content_layout() != ‘full-width’ ) : ?>
    <?php if ( function_exists( ‘is_shop’ ) && (is_shop() || is_product_category() ) ) : ?>

    <aside class=”<?php x_sidebar_class(); ?>” role=”complementary”>
    <?php if (x_is_shop() ) : ?>
    <?php dynamic_sidebar(‘ups-sidebar-shop’ ); ?>
    <?php endif; ?>
    <?php if ( get_option( ‘ups_sidebars’ ) != array() ) : ?>
    <?php dynamic_sidebar( apply_filters( ‘ups_sidebar’, ‘sidebar-main’ ) ); ?>
    <?php else : ?>
    <?php dynamic_sidebar( ‘sidebar-main’ ); ?>
    <?php endif; ?>
    </aside>

    <?php endif; ?>

    I got an error message. At one point, some text appeared in the space where my sidebar should have gone, but now there’s nothing.

    Please help.

    #1278449
    Rupok
    Member

    Hi there,

    Please provide your URL and show us a screenshot of the error message.

    Thanks!

    #1278454
    nextstepsyep
    Participant

    And, while I’ve got your attention . . .

    I somehow managed to add a second set of product categories to my shop page. Could you please teach me how to remove the second set?

    Thanks!

    #1278463
    Paul R
    Moderator

    Hi,

    Please provide us your site url so we can provide you with a tailored answer.

    Thanks

    #1278756
    nextstepsyep
    Participant

    My apologies Paul!

    Home

    #1279193
    Rad
    Moderator

    Hi there,

    You can use filter and hooks to implement your custom sidebar. Like from here https://community.theme.co/forums/topic/woocommerce-product-category-sidebar/#post-242520

    You don’t need to add or modify sidebar templates or CSS, just add the code to child theme’s functions.php

    As for your other question, I checked it and I’m not sure what is the second set. Would you mind providing a screenshot?

    Thanks!

    #1280052
    nextstepsyep
    Participant

    Greetings Rad,

    Thanks for the links! I searched through the knowledge base for hours and couldn’t find them.

    This is the link that ultimately helped me get the sidebar on the left side of my category page. I’m still working on getting rid of that duplicate from my home page.

    https://community.theme.co/forums/topic/sidebar-on-single-product-page-4/#post-170005

    Here’s the code I replaced in my functions.php file:

    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_archive() ) {
            if ( x_is_shop() || x_is_product_category() || x_is_product_tag() || x_is_product() ) {
              $layout = 'sidebar-content';
            } else {
              $opt    = x_get_option( 'x_archive_layout', 'sidebar' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            }
          } elseif ( x_is_product() ) {
            $layout = 'sidebar-content';
          } 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;
        }
    
          if ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
            $layout = 'sidebar-content';
          } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
            $layout = 'sidebar-content';
          } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
            $layout = 'full-width';
          }
    
        return $layout;
    
      }
    
    add_filter( 'ups_sidebar', function ( $default_sidebar ) {
    
      $sidebars = get_option( 'ups_sidebars' );
    
      foreach ( $sidebars as $id => $sidebar ) {
        if (  x_is_shop() || x_is_product_category() || x_is_product_tag() || x_is_product() ) {
          if ( array_key_exists( 'index-shop', $sidebar ) && $sidebar['index-shop'] == 'on' ) {
            return $id;
          }
        }
      }
    
      return $default_sidebar;
    
    }, 9999 );
    #1280272
    Christopher
    Moderator

    Hi there,

    Please update your code in child theme’s functions.php file to :

    if ( ! function_exists( 'x_get_content_layout' ) ) :
      function x_get_content_layout() {
    
        $stack          = x_get_stack();
        $content_layout = x_get_option('x_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;
    

    Hope it helps.

    #1283454
    nextstepsyep
    Participant

    Greetings Rod,

    My apologies for the delay in providing a screen shot. I’ve been working on implementing the other recommendations you guys have been providing me with. A million thanks for all your help.

    What’s Left To Do:
    Here are the screenshots of the double sidebar, recent posts, and product pages.

    Double Sidebar – I’d just like to only have one of these on the main shop page

    Recent Posts – I can see the posts perfectly well in the backend. It’s the front end that’s kinda wonky.

    Sidebar on Product Page – I would like to remove this all single product pages.

    #1284061
    Lely
    Moderator

    Hi There,

    Would you mind providing us with login credentials so we can take a closer look on your settings? See attached screenshot for errors on your page. To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

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

    #1284810
    nextstepsyep
    Participant
    This reply has been marked as private.
    #1285221
    Rad
    Moderator

    Hi there,

    It looks like due to the previous customization you did on wp-sidebar.php, unfortunately, I can only check it through FTP. Would you mind providing your FTP login credentials as well?

    The recent posts issue is due to custom code too.

    Thanks!

    #1285393
    nextstepsyep
    Participant
    This reply has been marked as private.
    #1285512
    nextstepsyep
    Participant

    OMG! I suck so hard right now 🙁

    I went back through my own archive and re-traced my steps. Lo, and behold, I found the answers you had already provided me to the questions I had months ago.

    I’m so very, very sorry for wasting your time.

    This totally got rid of my double sidebar…again!
    https://community.theme.co/forums/topic/woocommerce-sidebar-function-for-full-width-page/#post-1065903

    Thanks X Fam!!!
    XOXOXO

    #1285677
    Rue Nel
    Moderator

    Hello There,

    We are just glad that you have figured it out a way to correct the said issue.
    Thanks for letting us know!

    Best Regards.

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