This topic has 7 replies, 2 voices, and was last updated 4 years, 3 months ago ago by Olga Barlow
Good evening
I wanted a hand because I can’t print a value in the database,
I need to make a feed in xml for a price comparator
But I can’t print the brand name ( only text not the image path )
How can I do it? I would like to create a shortcode, to upload on booster.io
Thanks in advance
Hello,
Do you use the REST API? Or what do you use to make feed?
Regards
Is there any news about this?
Hello,
Sorry for the delay in answering.
Try the following code to register [et_single_product_brand_names] shortcode
add_shortcode( 'et_single_product_brand_names', 'et_single_product_brand_names' );
if ( ! function_exists( 'et_single_product_brand_names' ) ) {
function et_single_product_brand_names( $atts = array() ) {
$product_id = get_the_ID();
$terms = wp_get_post_terms( $product_id, 'brand' );
$brand = etheme_get_option( 'brand_title' );
if ( count( $terms ) < 1 ) {
return;
}
$_i = 0;
$brand_titles = '';
foreach ( $terms as $brand ) { $_i ++;
$brand_titles .= esc_html( $brand->name );
if ( count( $terms ) > $_i ) {
$brand_titles .= ", ";
}
}
return $brand_titles;
}
}
Regards
Perfect work it
Thank you
You are welcome!
Regards
You must be logged in to reply to this topic.Log in/Sign up