向产品档案添加简短描述

编程入门 行业动态 更新时间:2024-10-12 05:55:57
本文介绍了向产品档案添加简短描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试向我的商店档案添加简短说明.现在唯一显示的是图像,标题,价格,&添加到购物车按钮.

使用添加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);

结果:d.pr/free/i/kUiz7z

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: d.pr/free/i/kUiz7z

更多推荐

向产品档案添加简短描述

本文发布于:2023-11-12 11:22:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581361.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:简短   档案   产品

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!