wordpress - how to add a sidebar to a woocommerce page -
i have wordpress site , i'm using woocommerce pluging. have product page , sidebar showing @ bottom of page. how edit code put sidebar shows sidebar on left of main content area. not under main content area?
the code template is:
<?php /** * woocommerce_before_main_content hook * * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs content) * @hooked woocommerce_breadcrumb - 20 */ do_action( 'woocommerce_before_main_content' ); ?> <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?> <h1 class="page-title"><?php woocommerce_page_title(); ?></h1> <?php endif; ?> <?php do_action( 'woocommerce_archive_description' ); ?> <?php if ( have_posts() ) : ?> <?php /** * woocommerce_before_shop_loop hook * * @hooked woocommerce_result_count - 20 * @hooked woocommerce_catalog_ordering - 30 */ do_action( 'woocommerce_before_shop_loop' ); ?> <?php woocommerce_product_loop_start(); ?> <?php woocommerce_product_subcategories(); ?> <?php while ( have_posts() ) : the_post(); ?> <?php wc_get_template_part( 'content', 'product' ); ?> <?php endwhile; // end of loop. ?> <?php woocommerce_product_loop_end(); ?> <?php /** * woocommerce_after_shop_loop hook * * @hooked woocommerce_pagination - 10 */ do_action( 'woocommerce_after_shop_loop' ); ?> <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?> <?php wc_get_template( 'loop/no-products-found.php' ); ?> <?php endif; ?> <?php /** * woocommerce_after_main_content hook * * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs content) */ do_action( 'woocommerce_after_main_content' ); ?> <?php /** * woocommerce_sidebar hook * * @hooked woocommerce_get_sidebar - 10 */ do_action( 'woocommerce_sidebar' ); ?>
you need edit wrapper support woocommerce template system. done in 1 of 2 ways.
the first create woocommerce.php
file (using theme's sidebar layout template base) in theme directory proper. override woocommerce wrapper system , archive-product.php
template. give bit more control since work based on theme. need replace loop in template <?php woocommerce_content(); ?>
can comment out sidebar in example above , use theme's set sidebar location woocommerce sidebar <?php do_action( 'woocommerce_sidebar' );?>
. see http://docs.woothemes.com/document/third-party-custom-theme-compatibility/ more information on this.
the other option edit woocommerce wrapper adjust classes sidebar have enough room. <?php do_action( 'woocommerce_after_main_content' );?>
end of wrapper. that's in woocommerce template system under global > wrapper-start.php
, global > wrapper-end.php
(make sure these copied on theme directory under woocommerce folder in respective folders).
Comments
Post a Comment