我希望使用这个短代码:
[product_category category="music"]
哪个输出此代码:
<div class="woocommerce columns-4">
<ul class="products">
<li class="post-83 product type-product status-publish has-post-thumbnail product_cat-albums product_cat-music first instock downloadable shipping-taxable purchasable product-type-simple">
<a href="http://localhost/websitename/product/woo-album-1/" class="woocommerce-LoopProduct-link"><img width="300" height="300" src="http://localhost/websitename/wp-content/uploads/2013/06/cd_1_angle-300x300.jpg" class="attachment-shop_catalog size-shop_catalog wp-post-image" alt="cd_1_angle" title="cd_1_angle" srcset="http://localhost/websitename/wp-content/uploads/2013/06/cd_1_angle-300x300.jpg 300w, http://localhost/websitename/wp-content/uploads/2013/06/cd_1_angle-150x150.jpg 150w, http://localhost/websitename/wp-content/uploads/2013/06/cd_1_angle-768x768.jpg 768w, http://localhost/websitename/wp-content/uploads/2013/06/cd_1_angle-180x180.jpg 180w, http://localhost/websitename/wp-content/uploads/2013/06/cd_1_angle-600x600.jpg 600w, http://localhost/websitename/wp-content/uploads/2013/06/cd_1_angle.jpg 1000w" sizes="(max-width: 300px) 100vw, 300px">
<h3>Woo Album #1</h3>
<span class="price"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>9.00</span></span>
</a><a rel="nofollow" href="/websitename/?add-to-cart=83" data-quantity="1" data-product_id="83" data-product_sku="" class="button product_type_simple add_to_cart_button ajax_add_to_cart">Add to cart</a></li>
<li class="post-87 product type-product status-publish has-post-thumbnail product_cat-albums product_cat-music instock featured downloadable shipping-taxable purchasable product-type-simple">
<a href="http://localhost/websitename/product/woo-album-2/" class="woocommerce-LoopProduct-link"><img width="300" height="300" src="http://localhost/websitename/wp-content/uploads/2013/06/cd_2_angle-300x300.jpg" class="attachment-shop_catalog size-shop_catalog wp-post-image" alt="cd_2_angle" title="cd_2_angle" srcset="http://localhost/websitename/wp-content/uploads/2013/06/cd_2_angle-300x300.jpg 300w, http://localhost/websitename/wp-content/uploads/2013/06/cd_2_angle-150x150.jpg 150w, http://localhost/websitename/wp-content/uploads/2013/06/cd_2_angle-768x768.jpg 768w, http://localhost/websitename/wp-content/uploads/2013/06/cd_2_angle-180x180.jpg 180w, http://localhost/websitename/wp-content/uploads/2013/06/cd_2_angle-600x600.jpg 600w, http://localhost/websitename/wp-content/uploads/2013/06/cd_2_angle.jpg 1000w" sizes="(max-width: 300px) 100vw, 300px">
<h3>Woo Album #2</h3>
<div class="star-rating" title="Rated 4 out of 5">
<span style="width:80%"><strong class="rating">4</strong> out of 5</span>
</div>
<span class="price"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>9.00</span></span>
</a><a rel="nofollow" href="/websitename/?add-to-cart=87" data-quantity="1" data-product_id="87" data-product_sku="" class="button product_type_simple add_to_cart_button ajax_add_to_cart">Add to cart</a></li>
<li class="post-90 product type-product status-publish has-post-thumbnail product_cat-albums product_cat-music instock downloadable shipping-taxable purchasable product-type-simple">
<a href="http://localhost/websitename/product/woo-album-3/" class="woocommerce-LoopProduct-link"><img width="300" height="300" src="http://localhost/websitename/wp-content/uploads/2013/06/cd_3_angle-300x300.jpg" class="attachment-shop_catalog size-shop_catalog wp-post-image" alt="cd_3_angle" title="cd_3_angle" srcset="http://localhost/websitename/wp-content/uploads/2013/06/cd_3_angle-300x300.jpg 300w, http://localhost/websitename/wp-content/uploads/2013/06/cd_3_angle-150x150.jpg 150w, http://localhost/websitename/wp-content/uploads/2013/06/cd_3_angle-768x768.jpg 768w, http://localhost/websitename/wp-content/uploads/2013/06/cd_3_angle-180x180.jpg 180w, http://localhost/websitename/wp-content/uploads/2013/06/cd_3_angle-600x600.jpg 600w, http://localhost/websitename/wp-content/uploads/2013/06/cd_3_angle.jpg 1000w" sizes="(max-width: 300px) 100vw, 300px">
<h3>Woo Album #3</h3>
<div class="star-rating" title="Rated 3 out of 5">
<span style="width:60%"><strong class="rating">3</strong> out of 5</span>
</div>
<span class="price"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>9.00</span></span>
</a><a rel="nofollow" href="/websitename/?add-to-cart=90" data-quantity="1" data-product_id="90" data-product_sku="" class="button product_type_simple add_to_cart_button ajax_add_to_cart">Add to cart</a></li>
<li class="post-96 product type-product status-publish has-post-thumbnail product_cat-albums product_cat-music last instock downloadable shipping-taxable purchasable product-type-simple" style=" margin-right: 0; ">
<a href="http://localhost/websitename/product/woo-album-4/" class="woocommerce-LoopProduct-link"><img width="300" height="300" src="http://localhost/websitename/wp-content/uploads/2013/06/cd_5_angle-300x300.jpg" class="attachment-shop_catalog size-shop_catalog wp-post-image" alt="cd_5_angle" title="cd_5_angle" srcset="http://localhost/websitename/wp-content/uploads/2013/06/cd_5_angle-300x300.jpg 300w, http://localhost/websitename/wp-content/uploads/2013/06/cd_5_angle-150x150.jpg 150w, http://localhost/websitename/wp-content/uploads/2013/06/cd_5_angle-768x768.jpg 768w, http://localhost/websitename/wp-content/uploads/2013/06/cd_5_angle-180x180.jpg 180w, http://localhost/websitename/wp-content/uploads/2013/06/cd_5_angle-600x600.jpg 600w, http://localhost/websitename/wp-content/uploads/2013/06/cd_5_angle.jpg 1000w" sizes="(max-width: 300px) 100vw, 300px">
<h3>Woo Album #4</h3>
<div class="star-rating" title="Rated 5 out of 5">
<span style="width:100%"><strong class="rating">5</strong> out of 5</span>
</div>
<span class="price"><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">£</span>9.00</span></span>
</a><a rel="nofollow" href="/websitename/?add-to-cart=96" data-quantity="1" data-product_id="96" data-product_sku="" class="button product_type_simple add_to_cart_button ajax_add_to_cart">Add to cart</a></li>
</ul>
</div>
我希望在每个产品的
<div>
内添加一个包含<li>
。 我这样做是因为我想在<li>
中添加网格填充,并希望在<div>
我正在补充。
有没有办法修改短代码输出来做到这一点?
任何建议都会非常感激。
我知道我可以通过复制短代码的功能来做到这一点,但这似乎有点过分只是为了添加<div>
。
我可以用jQuery做到这一点,但不要在加载时有任何延迟。
我也曾在in this answer之前尝试过,但这对我真正想要的东西来说并不方便。