向产品档案添加简短描述 [英] Adding A Short Description To Product Archives
问题描述
我正在尝试向我的商店档案添加简短说明.现在唯一显示的是图像,标题,价格,&添加到购物车按钮.
使用添加WooCommerce 存档页面中产品标题下的简短描述"答案代码,我能够显示简短的描述.
这个问题是出于某种原因将它添加在产品图片上方,而不是在标题和;我想要的价格.知道如何修复它吗?
尝试以下操作:
function woocommerce_after_shop_loop_item_title_short_description() {全球$产品;如果(!$product->get_short_description())返回;?><div itemprop="描述"><?php echo apply_filters('woocommerce_short_description', $product->get_short_description()) ?>
<?php}add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item_title_short_description', 5);
I'm trying to add a short description to my shop archives. Right now the only things showing are the image, title, price, & add to cart button.
Using "Add shortened description under the product title in WooCommerce archive pages" answer code, I was able to get the short description to show.
This issue with this is for some reason it adds it above the product image, not between the title & price where I would like it. Any idea how to fix it?
Try the following:
function woocommerce_after_shop_loop_item_title_short_description() {
global $product;
if ( ! $product->get_short_description() ) return;
?>
<div itemprop="description">
<?php echo apply_filters( 'woocommerce_short_description', $product->get_short_description() ) ?>
</div>
<?php
}
add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item_title_short_description', 5);
The result: https://d.pr/free/i/kUiz7z
这篇关于向产品档案添加简短描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!