Tagged: x
-
AuthorPosts
-
January 3, 2017 at 2:39 am #1313842
nicola.volpi86ParticipantHi, I need to know how it is possibile to add the sidebar, that I have created in the Sidebars Section, inside the product page.
Actually the product page is full width.Thanks for your answer
RegardsJanuary 3, 2017 at 2:57 am #1313857
Paul RModeratorHi,
To add sidebar in your product’s page, you can add the code below in your child theme’s functions.php file.
function add_sidebar_product($contents) { if ( x_is_product() ) { $contents = 'content-sidebar'; } return $contents; } add_filter('x_option_x_layout_content', 'add_sidebar_product');Hope that helps
January 3, 2017 at 4:46 am #1313926
nicola.volpi86ParticipantIt doesn’t work
January 3, 2017 at 4:53 am #1313932
Paul RModeratorHi,
To further assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
January 3, 2017 at 5:25 am #1313954
nicola.volpi86ParticipantThis reply has been marked as private.January 3, 2017 at 5:25 am #1313955
nicola.volpi86ParticipantJanuary 3, 2017 at 5:52 am #1313989
ChristopherModeratorHi there,
Please update previous code to :
//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; // Add custom sidebar to product page// //=================================================== add_filter( 'ups_sidebar', 'product_sidebar_2', 9999 ); function product_sidebar_2 ( $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 custom sidebar ID.Hope it helps.
January 3, 2017 at 7:56 am #1314096
nicola.volpi86ParticipantSorry but it doesn’t work anymore
January 3, 2017 at 8:04 am #1314107
Paul RModeratorHi,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
January 3, 2017 at 9:09 am #1314148
nicola.volpi86ParticipantThis reply has been marked as private.January 3, 2017 at 10:39 pm #1315251
ChristopherModeratorHi there,
Upon checking your host files, you didn’t setup child theme yet.
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.After setting it up, follow my previous replay https://community.theme.co/forums/topic/add-sidebar-in-product-page/#post-1313989
Hope it helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1313842 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
