limit in pod field display
-
hi, I created three additional fields for the products (artist, serial, year). To view them in the woocommerce product grid I inserted this code into functions.php:
add_action('woocommerce_after_shop_loop_item_title', function() {
global $WCFM, $WCFMmp, $product;
if( !$product ) return;
$product_id = $product->get_id();
$artist_name = get_post_meta( $product_id, 'artist_name', true )['post_title'];
if( $artist_name ) {
echo "
". $artist_name ."";
}
}, 50 );
add_action('woocommerce_after_shop_loop_item_title', function() {
global $WCFM, $WCFMmp, $product;
if( !$product ) return;
$product_id = $product->get_id();
$serial = get_post_meta( $product_id, 'serial', true )['post_title'];
if( $serial ) {
echo "
". $serial ."";
}
}, 50 );
add_action('woocommerce_after_shop_loop_item_title', function() {
global $WCFM, $WCFMmp, $product;
if( !$product ) return;
$product_id = $product->get_id();
$year = get_post_meta( $product_id, 'year', true )['post_title'];
if( $year ) {
echo "
". $year ."";
}
}, 50 );the problem is that I see the artist’s name correctly, but not the serial and year, I only see the first letter or the first number. Where am I wrong?
Thanks for any helpThe page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.