【发布时间】:2017-04-09 22:32:09
【问题描述】:
我正在尝试为 wordpress / WooCommerce 构建自定义简码,这样我就可以只选择一个产品的图片或价格,因为我想为产品页面设置样式,但我不能用自己制作的简码...
我在谷歌上看了很多,尝试了多个代码 en previewuws 但没有成功:(
也许有人可以帮助我?
这就是我现在所拥有的,到目前为止还有效!!
//Select just one img from a WooCommerce product.
function singleProduct_img( $atts ) {
$a = shortcode_atts( array(
'product_id' => '',
), $atts );
return $a['product_id'];
}
add_shortcode( 'singleProduct_img', 'singleProduct_img' );
我使用的简码是:[singleProduct_img product_id="233"],输出是“233”
现在我希望我可以返回 id="233" 的产品图片
顺便说一句:
Woo = 2.6.8 版
WP = 版本 4.6.1–nl_NL
任何帮助将不胜感激,
谢谢
【问题讨论】: