【发布时间】:2021-09-25 18:11:10
【问题描述】:
您好,我正在尝试创建一个自定义插件,该插件将显示来自 Woocommerce 插件的主要产品图像。我想使用简码。我该怎么做呢?这就是我所拥有的,但它没有用。我也发现了不同的建议。我将在下面分享所有内容
add_shortcode( 'product_image', 'bbloomer_product_image_shortcode' );
function bbloomer_product_reviews_shortcode() {
return woocommerce_get_product_thumbnail();
}
<?php
$gallery_shortcode = '[gallery id="' .intval($post->$post_parent).'"]';
print apply_filters('the_content', $gallery_shortcode);
?>
这些是我之前发现/建议给我的
【问题讨论】:
-
您要在产品页面上使用该短代码吗?
标签: php wordpress woocommerce plugins