Tagged: x
-
AuthorPosts
-
September 26, 2016 at 7:18 am #1190741
TeapotCreativeParticipantHi,
I cant see an option for adding a sidebar to a woocommerce product page.
Can you let me know where the option is as I have looked in theme customiser > woocommerce.
Thanks
nickSeptember 26, 2016 at 8:35 am #1190806
Paul RModeratorHi Nick,
Sorry there is no option in the customizer for that.
To achieve that, you can add this in your child theme’s function.php file.
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_product() ) { $layout = 'content-sidebar'; } return $layout; }Hope that helps.
September 29, 2016 at 5:50 am #1195522
TeapotCreativeParticipantthanks, that works but how can I add a new sidebar in to use just on woocommerce product pages as this seems to just add the standard one
September 29, 2016 at 6:04 am #1195540
Paul RModeratorHi,
Please refer to the links below.
https://community.theme.co/kb/unlimited-sidebars/
Hope that helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1190741 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
