簡體   English   中英

woocommerce - 更改類別中的產品的HTML

[英]woocommerce - change the html of products in category

product的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>

我發現它的唯一方法是我應該編輯插件的核心,這是沒用的,因為我會在更新后丟失所有更改。

編輯:例如這個主題 ,他們有這樣的結構:

<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>

您可以覆蓋模板文件,並在更新woocommerce時不會更新。

來自WooCommerce 文檔

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

示例:要覆蓋管理員訂單通知,請將:woocommerce / templates / emails / admin-new-order.php復制到yourtheme / woocommerce / emails / admin-new-order.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM