2014-09-01 122 views
3

產品的HTML看起來像這樣:woocommerce - 改變產品的HTML類別

<li class="post-13 product type-product status-publish has-post-thumbnail first taxable shipping-taxable purchasable product-type-simple product-cat-printer instock"> 
    <a href="http://xxx"> 
     <img width="150" height="150" src="http://xx" class="attachment-shop_catalog wp-post-image" alt="" /> 
     <h3>abc</h3> 
     <span class="price"><span class="amount">15.86&nbsp;&euro;</span></span> 
    </a> 
    <div class="gridlist-buttonwrap"> 
     <a href="xx?add-to-cart=13" rel="nofollow" data-product_id="13" data-product_sku="" class="button add_to_cart_button product_type_simple">Buy</a> 
    </div> 
    <hr />   
</li> 

是否可以移動按鈕旁邊的價格是多少?

<li class="post-13 product type-product status-publish has-post-thumbnail first taxable shipping-taxable purchasable product-type-simple product-cat-printer instock"> 
    <a href="http://xxx"> 
     <img width="150" height="150" src="http://xx" class="attachment-shop_catalog wp-post-image" alt="" /> 
     <h3>abc</h3> 
    </a> 
    <div class="abc"> 
     <a href="xx?add-to-cart=13" rel="nofollow" data-product_id="13" data-product_sku="" class="button add_to_cart_button product_type_simple">Buy</a> 
     <span class="price"><span class="amount">15.86&nbsp;&euro;</span></span> 
    </div>   
</li> 

我發現它的唯一方法就是編輯插件的核心,這是無用的,因爲我將在更新後丟失所有更改。

編輯:例如this theme,他們有這樣的結構:

<li> 
    <a href="http://demo2.woothemes.com/sliding/shop/yellow-necklace/" style="width: 192px; height: 295px;"> 
     <img width="192" height="295" src="http://demo2.woothemes.com/sliding/files/2011/11/yellow-necklace-192x295.jpg" class="attachment-woo_sliding_slider wp-post-image" alt="yellow-necklace" /> 
     <div class="meta"> 
      <h3>Yellow Necklace</h3> 
      <span class="slider-price"><span class="amount">&pound;19.00</span></span> 
     </div> 

    </a> 

</li> 

回答

1

您可以覆蓋一個模板文件,當你更新woocommerce不會被更新。

從WooCommerce docs

或者,您也可以通過 覆蓋在升級安全的方式編輯這些文件。只需將其複製到名爲 /woocommerce的主題中的目錄中,即可保持相同的文件結構。

例:要在此改變管理秩序的通知,複製: woocommerce /模板/電子郵件/管理 - 新order.php到 yourtheme/woocommerce /電子郵件/管理 - 新order.php

+0

是,我知道,但我還沒有找到任何模板文件,我可以編輯這個 – dontHaveName 2014-09-01 17:02:26

+0

你找到了解決方案嗎?這裏同樣的問題。 – Max 2015-03-25 08:47:03