2016-11-09 122 views
0

我正在使用一個Wordpress主題的引導,我正在使用Woocommerce安裝。在Shop頁面上,儘管其他頁面(例如Checkout,Cart,My Account)在Bootstrap容器類中,並且顯示正常,但容器元素並未包裝側邊欄。但是,商店頁面也位於容器中,側邊欄顯示在所有內容下方。woocommerce側欄下方內容

下面是店鋪頁面

get_header('shop'); ?> 

<?php 
    /** 
    * woocommerce_before_main_content hook. 
    * 
    * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content) 
    * @hooked woocommerce_breadcrumb - 20 
    */ 
    do_action('woocommerce_before_main_content'); 
?> 
<div class="container"> 
<div class="row"> 
    <div class="col-md-8"> 
    <?php if (apply_filters('woocommerce_show_page_title', true)) : ?> 

     <h1 class="page-title"><?php woocommerce_page_title(); ?></h1> 

    <?php endif; ?> 

    <?php 
     /** 
     * woocommerce_archive_description hook. 
     * 
     * @hooked woocommerce_taxonomy_archive_description - 10 
     * @hooked woocommerce_product_archive_description - 10 
     */ 
     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 the 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 for the content) 
     */ 
     do_action('woocommerce_after_main_content'); 
    ?> 
    </div> 
    <div class="col-md-4">  
    <?php 
     /** 
     * woocommerce_sidebar hook. 
     * 
     * @hooked woocommerce_get_sidebar - 10 
     */ 
     do_action('woocommerce_sidebar'); 
    ?> 
    </div> 
</div> 
</div> 

<?php get_footer('shop'); ?> 

回答

0

代碼內容div下下降的邊欄,意味着你有HTML標記錯誤;這通常是關閉</div>或兩個在頁面底部丟失。額外開放<div>的也可能導致邊欄下降。

想想你開<div></div>的和使用的所有網頁模板和模板零件文件匹配起來:header.php,店鋪模板,footer.php和任何其他包含的模板文件。

或者,在頁面上查看源代碼並進行匹配,找到錯誤並在相應的模板文件中進行更正。

或者,使用W3C代碼驗證工具找到它們https://validator.w3.org/以及其他您可能不知道的標記錯誤,然後在模板文件中進行更正。