Remove sidebar on product page

ST Started by Spiracle Themes · June 25, 2018 at 1:09 pm · 2 replies 2 voices Last reply 8 years ago
ST
Spiracle Themes Member
#2

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

Post a reply

Join the conversation. Be kind — this is a public forum.

Replying to Remove sidebar on product page

By posting, your reply becomes public (unless marked private).