问题描述
如何正确使用此功能:
<?PHP echo do_shortcode('[product id="<?PHP the_field('wyrozniony_produkt_id')?>"]'); ?>
我需要在3931的地方写上
<?PHP echo do_shortcode('[product id="3931"]'); ?>
此短代码(ACF中的文本字段)
<?PHP the_field('wyrozniony_produkt_id')?>
有人知道怎么做吗?
解决方法
您的语法似乎有误 请检查您的更新代码
<?php
$product_id = get_field('wyrozniony_produkt_id');
echo do_shortcode('[product id="'.$product_id.'"]');
?>