Tagged: x
-
AuthorPosts
-
June 16, 2016 at 12:30 pm #1045541
Eric MParticipantwhen connecting a custom sidebar to a certain page, you select that page on the sidebar page. Im trying to do the same for each product in an eCommerce store but not seeing where to select the product. Am i missing something?
June 16, 2016 at 1:52 pm #1045676
RupokMemberHi there,
You can’t select for individual products. Custom sidebars will work for pages, posts and taxonomies. For others, the main sidebar will be used.
Cheers!
June 21, 2016 at 8:42 am #1052524
Eric MParticipantSo ive followed the instructions on this page: https://community.theme.co/forums/topic/sidebar-in-single-product-page-woocommerce/
What do i change to tell which product ID i want the sidebar to appear on?
June 21, 2016 at 2:42 pm #1053095
NicoModeratorHi There,
Not sure if the code is still working because the thread is quite from the past date already.
It is quite a custom code and it beyond the scope of our support however I could guide you a bit of what to change.
You need to modify this code in the thread to make it specific for a product page.
add_filter( 'ups_sidebar', 'product_sidebar', 9999 ); function product_sidebar ( $default_sidebar ) { $sidebars = get_option( 'ups_sidebars' ); foreach ( $sidebars as $id => $sidebar ) { if ( x_is_product() ) { if ( array_key_exists( 'index-shop', $sidebar ) && $sidebar['index-shop'] == 'on' ) { return $id; } } } return $default_sidebar; }Hope it helps.
Thank you so much for understanding.
June 22, 2016 at 10:56 am #1054539
Eric MParticipantbut what part is calling the single product?
June 22, 2016 at 6:17 pm #1055251
RadModeratorHi Eric,
This condition
if ( x_is_product() ), and if you wish to make it more specific to product page then you can do something like this,if ( x_is_product() && is_single( 923 ) ) {Where 923 is the product ID. Or if you wish a condition with multiple ID, then it can be like this,
if ( x_is_product() && is_single( array( 923, 924, 925 ) ) ) {Hope that helps.
June 27, 2016 at 5:18 pm #1062277
Eric MParticipantawesome thanks.
June 27, 2016 at 10:03 pm #1062639
NicoModeratorHappy to hear that.
Feel free to ask us again.
Thanks.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1045541 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
