Woocommerce商店缩略图上的自定义文本标签 [英] Custom text label on Woocommerce shop thumbnail images

查看:73
本文介绍了Woocommerce商店缩略图上的自定义文本标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Woocommerce主题,用于在线商店.

Am using a Woocommerce theme for a online shop.

我想在每个缩略图的顶部显示一些自定义文本.类似于以下示例.我了解我必须摆弄 archive-product.php 文件.而且我还需要设置相同的样式.

Where i do like to display some custom text on top of each thumbnail. Something like the following example. I understand that i have to fiddle with the archive-product.phpfile. And also i need to style the same.

有人能指出我正确的方向吗?还可以通过高级自定义字段插件"完成相同的工作吗?

Can someone point me in the right direction. Also is it possible to accomplish the same via Advance Custom Field Plugin?

推荐答案

您应该能够通过ACF(高级自定义字段)完成此操作.创建自定义字段时,您将 post_type 分配给WooCommerce产品.

You should be able to accomplish this via ACF (Advanced Custom Fields). When you create the custom field you assign the post_type to a WooCommerce product.

然后在产品循环中,您只需利用ACF的 get_field()进行获取.也许您必须查询每个产品的ID,然后将其插入ACF的函数中,如下所示: get_field('my_text',123); (id = 123).

Then in the products loop you just make use of ACF's get_field() to fetch it. Maybe you have to query the ID of each product and then insert it in ACF's function like this: get_field('my_text', 123); (id = 123).

这篇关于Woocommerce商店缩略图上的自定义文本标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆