Remove sidebar on product page

Spiracle Themes June 25, 2018 at 1:09 pm

I was wondering how i might achieve removing the sidebar from the single product page and make the page use the whole container?

Replies (2)

  1. Spiracle Themes June 25, 2018 at 1:09 pm

    I was wondering how i might achieve removing the sidebar from the single product page and make the page use the whole container?

  2. Spiracle Themes June 26, 2018 at 4:52 am

    Hi Hankgotti,

    You need to edit the code. Please follow the steps below

    Step 1) First of all you need to go to the theme root folder ie wp-content/themes/krystal-shop

    Step 2) Next go to folder template-parts

    Step 3) You will find a file content-woocommerce.php there. Open this file in any text editor and replace all the code.

    <?php
    /**
     * Template part for displaying woocommerce content in page.
     *
     * @link https://codex.wordpress.org/Template_Hierarchy
     *
     * @package krystal-shop
     */
    
    ?>
    
    <div class="container">
    	<div class="row">
    		<?php
    			if(is_product()){
    				?>
    					<div class="col-md-12">
    						<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    							<div class="entry-content">
    								<div class="woocommerce">
    									<?php
    										woocommerce_content();						
    									?>
    								</div>					
    							</div><!-- .entry-content -->				
    						</article><!-- #post-## -->
    					</div>
    				<?php
    			}
    			else if("right" === esc_attr(get_theme_mod( 'kr_shop_styles','right' ))) {
    				?>
    					<div class="col-md-8">
    						<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    							<div class="entry-content">
    								<div class="woocommerce">
    									<?php
    										woocommerce_content();						
    									?>
    								</div>					
    							</div><!-- .entry-content -->				
    						</article><!-- #post-## -->
    					</div>
    					<div class="col-md-3 col-md-offset-1">
    						<div class="woo-sidebar">
    							<div class="entry-content">
    								<div class="woocommerce">
    									<?php get_sidebar('woosidebar'); ?>
    								</div>
    							</div>
    						</div>
    					</div>
    				<?php
    			}
    			else if("left" === esc_attr(get_theme_mod( 'kr_shop_styles','right' ))) {
    				?>
    					<div class="col-md-3">
    						<div class="woo-sidebar">
    							<div class="entry-content">
    								<div class="woocommerce">
    									<?php get_sidebar('woosidebar'); ?>
    								</div>
    							</div>
    						</div>
    					</div>
    					<div class="col-md-8 col-md-offset-1">
    						<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    							<div class="entry-content">
    								<div class="woocommerce">
    									<?php
    										woocommerce_content();						
    									?>
    								</div>					
    							</div><!-- .entry-content -->				
    						</article><!-- #post-## -->
    					</div>
    				<?php
    			}
    			else{
    				?>
    					<div class="col-md-12">
    						<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    							<div class="entry-content">
    								<div class="woocommerce">
    									<?php
    										woocommerce_content();						
    									?>
    								</div>					
    							</div><!-- .entry-content -->				
    						</article><!-- #post-## -->
    					</div>
    				<?php		
    			}
    		?>
    	</div>
    </div>

    Step 4) Save file and refresh your page

    Regards

  3. Spiracle Themes June 26, 2018 at 12:38 pm

    Perfect exactly what i was looking for thanks!

Post a Reply

Reply To: Remove sidebar on product page
Your information: