将产品标题移至Woocommerce存档页面上的产品图片上方 [英] Move product title above product image on Woocommerce archive pages
问题描述
我正在尝试将产品标题移到产品档案页面上的产品图片上方.我设法弄清楚了如何移动信息,但是价格也在图像上方移动.
I am trying to move the product title above the product image on the product archive page. I have managed to figure out how to move the information, but the price is moving above the image aswell.
我只希望产品标题在产品图片上方.价格应保持在下方,并带有添加到购物车"按钮等.
I want only the product title to be above the product image. The price should remain below, with the add to cart button etc.
这是到目前为止我的代码段和结果的屏幕截图:
Here is my code snippet and screenshot of result so far:
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
推荐答案
相反,请尝试以下操作,在该位置,您将在产品标题后设置产品缩略图:
Instead try the following, where you will set the product thumbnail just after the product title:
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 11 );
代码进入您的活动子主题(或活动主题)的function.php文件中.经过测试,可以正常工作.
Code goes in function.php file of your active child theme (or active theme). Tested and works.
它也应该为您工作.
这篇关于将产品标题移至Woocommerce存档页面上的产品图片上方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!