【发布时间】:2021-05-01 03:09:41
【问题描述】:
我想将带有产品 ID 的变量放在 html 引号的引号中。
if ( ! function_exists( 'woocommerce_template_loop_product_link_open' ) ) {
/**
* Insert the opening anchor tag for products in the loop.
*/
function woocommerce_template_loop_product_link_open() {
global $product;
$id = $product->get_id();
$link = apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product );
echo '<a href="#" class="yith-wcqv-button" data-product_id="$id">';
}
}
$id 应该在 data-product_id="$id" 但我不知道该怎么做
【问题讨论】:
标签: php html wordpress string woocommerce