2014-09-01 117 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