Tagged: x
-
AuthorPosts
-
February 21, 2017 at 1:29 am #1379374
Sam GParticipantHi Team
Firstly, looking forward to the new menu functionality!!
I’m migrating a large blog from Ecwid to WooCommerce, and have noticed the single product pages still don’t allow for a sidebar?
I’ve seen posts from back in 2015 regarding this issue – am I missing something, or still no option for it within X Customizer?
Cheers,
SamFebruary 21, 2017 at 3:26 am #1379474
ChristopherModeratorHi there,
This option is still not available.
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Please add following code in child theme’s functions.php file :
//Add sidebar to single product // ============================================================================= 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;if you want to display custom sidebar, please ad following code as well :
// Add custom sidebar to product page// //=================================================== add_filter( 'ups_sidebar', 'product_sidebar', 9999 ); function product_sidebar ( $default_sidebar ) { if ( x_is_product() ) return 'ups-sidebar-custom-sidebar'; //Must match the ID of your target sidebar return $default_sidebar; }Instead of
ups-sidebar-custom-sidebaradd your custom sidebar ID.Hope it helps.
February 21, 2017 at 10:13 pm #1380825
Sam GParticipantMuch appreciated Chris, will get back to you if I come across any issues.
Any word on whether this will be implemented into Customizer down the track? From a user experience point of view, having no easy links back out into Shop Categories/Brands etc isn’t the best.
Cheers,
SamFebruary 22, 2017 at 2:42 am #1381005
ChristopherModeratorHi there,
For the time being this option is not available but our developers are trying to improve this, please stay tuned.
In regards with link, you can enable Breadcrumbs option under Customize -> Header.Let us know if you need further assist.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1379374 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
