[Resolved] Sidebar not showing for Single product

Tagged: 

  • Author
    Posts
  • #10504

    Andrew Misplon
    Keymaster

    Hi 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 🙂

    #10509

    Andrew Misplon
    Keymaster

    Please, 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/.

    #10534

    LazerCats557
    Participant

    Thanks 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

    #10535

    Andrew Misplon
    Keymaster

    You’ll need to make a small edit to the functions.php file in the child theme. The easiest would be to remove the polestar_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' );
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Scroll to top