jeudi 1 janvier 2015

WooCommerce: my markup changes in "archive-product.php" are overriden


Below is the default archive-product.php with only one change: I added <div id='main_content'> right after the get_header() call, and I closed this div element right before the sidebar call ( do_action( 'woocommerce_sidebar' ); ).



<?php
if ( ! defined( 'ABSPATH' ) ) exit;
get_header( 'shop' );
?>
<div id='main_content'>
<?php
do_action( 'woocommerce_before_main_content' );
do_action( 'woocommerce_archive_description' );
if ( have_posts() ) :
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();
woocommerce_product_subcategories();
while ( have_posts() ) : the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
woocommerce_product_loop_end();
do_action( 'woocommerce_after_shop_loop' );
elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) :
wc_get_template( 'loop/no-products-found.php' );
endif;
do_action( 'woocommerce_after_main_content' );
?>
</div>
<?php
do_action( 'woocommerce_sidebar' );
get_footer( 'shop' );
?>


Resulting markup should be:



<div id="main_content">
<div class="row"> [WC content] </div>
</div>
<div id="sidebar"> [WC Sidebar] </div>


Instead I get:



<div id="main_content">
<div class="row"> [WC content] </div>
<div id="sidebar"> [WC Sidebar] </div>
</div>


That is, the sidebar seems to have magically moved to inside my new div element. Why?





Aucun commentaire:

Enregistrer un commentaire