Tagged: x
-
AuthorPosts
-
December 22, 2016 at 3:35 pm #1302060
coldfirezzParticipantI understand that there is no option for sidebars on single product pages but the many bits of code I have found do not work. Any ideas with latest WooCommerce and X Theme?
December 22, 2016 at 9:19 pm #1302411
LelyModeratorHello There,
There is a settings on Appearance > Customize > Layout and Design > Content Layout > Choose with Sidebar template. That will give you sidebar for Single product page. But then that settings will also show sidebar on single post page and all archive pages. Is your requirement just to show sidebar specifically on single product page only? If yes, please try adding the following code on your child theme’s functions.php file:
if ( ! function_exists( 'x_get_content_layout' ) ) : 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 { if ( x_is_product() ) { $layout = 'sidebar-content'; }else{ $layout = $content_layout; } } return $layout; } endif;Hope this helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1302060 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
