Woocommerce商店页面自定义css

时间:2015-02-12 10:32:01

标签: wordpress woocommerce wordpress-theming

我是woocommerce的新手。我在产品列表中遇到问题,当我添加短代码时它显示了woocommerce html,类列表,但我想显示我的html,css我试过但它不是没有用,这是woocommerce代码..

<ul class="products">
    <li class="post-22 product type-product status-publish has-post-thumbnail first shipping-taxable purchasable product-type-simple product-cat-featured instock">
    <a href="http://localhost/wordpress/?product=mac-2">
        <img src="http://localhost/wordpress/wp-content/uploads/2015/02/2-240x300-240x300.jpg" class="attachment-shop_catalog wp-post-image" alt="2-240x300" height="300" width="240">
        <h3>Mac 2</h3>
    <span class="price"><span class="amount">£50.00</span></span>
    </a>
    <a href="/wordpress/?orderby=popularity&amp;post_type=product&amp;add-to-cart=22" rel="nofollow" data-product_id="22" data-product_sku="" data-quantity="1" class="button add_to_cart_button product_type_simple">Add to cart</a>
</li>

这是我的代码..

<div class="box-product product-carousel" id="featured-tab-carousel">
  <div class="slider-item">
    <div>
<div class="product-block" id="element_change">                   
  <div class="product-block-inner">
<div class="product-image-block">
  <?php echo do_shortcode('[product_category category="featured" per_page="12" columns="4" orderby="default" order="ASC"]');?>
  <div class="product-hover-block">
<div class="add-to-link">
 <div class="cart">
 <input type="button" value="Add to Cart" onclick="addToCart('43');" class="button" />
<em>Add to Cart</em>
  </div>
 <div class="wishlist"><a onclick="addToWishList('43');">Add to Wish List</a>
    <em>Add to Wish List</em>
  </div>
<div class="compare"><a onclick="addToCompare('43');">Add to Compare</a>
 <em>Add to Compare</em>
 </div>
</div>
<div class="rating"><img src="<?php echo get_template_directory_uri();?>/catalog/view/theme/OPC080180/<?php echo get_template_directory_uri();?>/image/stars-0.png" alt="Based on 0 reviews." /></div>  </div>
  </div>
 <div class="product_category_title"> - Software</div>
<div class="name"><a href="indexb8ca.html?route=product/product&amp;product_id=43">MacBook</a></div>
 <div class="product_info">
<div class="price">$589.50                                                  </div>
</div></div></div>

请帮我改变css ...

1 个答案:

答案 0 :(得分:1)

据说这可以作为一种方法,为Woocommerce提供自定义CSS样式表:

function enqueue_style_after_wc() {
    $deps = class_exists( 'WooCommerce' ) ? array( 'woocommerce-layout', 'woocommerce-smallscreen', 'woocommerce-general' ) : array();
    wp_enqueue_style( 'my-style', 'my-style.css', $deps, '1.0' );
}
add_action( 'wp_enqueue_scripts', 'enqueue_style_after_wc' );

来源: https://wordpress.stackexchange.com/questions/135171/woocommerce-include-custom-stylesheet-after-woocommerce-styling