- This topic has 4 replies, 2 voices, and was last updated 6 years, 1 month ago by Andrew Misplon.
Tagged: sidebar
- AuthorPosts
- September 11, 2018 at 6:25 pm #10503
LazerCats557ParticipantHi guys,
My client wants a sidebar on the single product page in woocommerce which was on by default on their old site. I can get the sidebar to display on the shop page but I cannot get it to display in the single-product page for the actual product. My client wants this side bar so they can include essential information for the buyer before purchasing.
It appears that the theme somehow has this hidden or turned off because every attempt to add the sidebar to single product pages has failed. I have tried plugins and even php edit on child theme’s unsuccessfully.
Thanks in advance,
JaredSeptember 11, 2018 at 6:49 pm #10504
Andrew MisplonKeymasterHi Jared
Thanks for posting. Polestar doesn’t offer a sidebar on single product pages. I’ll get back to you with a child theme solution. Chat then 🙂
September 12, 2018 at 11:05 am #10509
Andrew MisplonKeymasterPlease, find a child theme solution here: https://purothemes.com/wp-content/uploads/2018/09/polestar-child-wc-single-sidebar.zip
If you’re currently using a child theme, download the above and take a look at the changes I’ve made and integrate them into your child theme.
If you aren’t using a child theme at the moment then you’ll install this child theme from
Themes > Add New > Upload Theme
. To migrate your settings from the parent to the child, please see: https://purothemes.com/customizer-settings-export-import/.September 13, 2018 at 10:04 pm #10534
LazerCats557ParticipantThanks Andrew. It did successfully add the side bar. The only other challenge is that I need it on the right hand side. What do I need to do to make that happened. I tried to change it in customizer and it didn’t work.
Thanks again man,
Jared
September 14, 2018 at 8:32 am #10535
Andrew MisplonKeymasterYou’ll need to make a small edit to the
functions.php
file in the child theme. The easiest would be to remove thepolestar_child_body_classes
function and replace it with the following:/** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function polestar_child_body_classes( $classes ) { // WooCommerce sidebar. if ( is_active_sidebar( 'sidebar-shop' ) && ( function_exists( 'is_woocommerce' ) && is_woocommerce() && is_product() ) ) { $classes[] = 'woocommerce-sidebar'; if ( get_theme_mod( 'woocommerce_sidebar_position' ) == 'right' ) { $classes[] = 'woocommerce-sidebar-right'; } } return $classes; } add_filter( 'body_class', 'polestar_child_body_classes' );
- AuthorPosts
You must be logged in to reply to this topic.