Remove sidebar on product page

This topic has 2 replies, 2 voices, and was last updated 6 years, 8 months ago by Spiracle Themes.

Viewing 2 reply threads
  • Author
    Posts
    • #1194


      Spiracle Themes
      Keymaster

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

    • #1195


      Spiracle Themes
      Guest

      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

    • #1196


      Spiracle Themes
      Keymaster

      Perfect exactly what i was looking for thanks!

Viewing 2 reply threads

Reply To: Remove sidebar on product page

Your information: