这个问题已经在这里有一个答案:
我在这里找到了一些代码的网站上,以显示该类别页面的产品属性。这工作得很好,它表明我希望完美的属性,但是这将是非常完美的,如果我能得到这个仅低于日产品称号,而不是下面的按钮,因为它是现在。有人可以帮助我,我该怎么办呢?
/**
* PPM
*/
add_action( 'woocommerce_after_shop_loop_item', 'acf_template_loop_product_meta', 20 );
function acf_template_loop_product_meta() {
global $product;
// Check that we got the instance of the WC_Product object, to be sure (can be removed)
if( ! is_object( $product ) ) {
$product = wc_get_product( get_the_id() );
}
echo '<h4>Afdruksnelheid: ' . $product->get_attribute('pa_afdruksnelheid') .' PPM</h4>';
}
add_action( 'woocommerce_before_shop_loop_item_title', 'custom_before_title' );
function custom_before_title() {
global $product;
// Check that we got the instance of the WC_Product object, to be sure (can be removed)
if( ! is_object( $product ) ) {
$product = wc_get_product( get_the_id() );
}
echo '<h4>Afdruksnelheid: ' . $product->get_attribute('pa_afdruksnelheid') .' PPM</h4>';
}
有一个在你提到的地方没有勾准确。检查此hook guide更多信息