Xml feed and print text values - by Eugenio Provitera

This topic has 7 replies, 2 voices, and was last updated 3 years, 7 months ago ago by Olga Barlow

  • Avatar: Eugenio_Provitera
    Eugenio Provitera
    Participant
    September 16, 2020 at 22:17

    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

    6 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    September 17, 2020 at 09:46

    Hello,

    Do you use the REST API? Or what do you use to make feed?

    Regards

    Avatar: Eugenio_Provitera
    Eugenio Provitera
    Participant
    September 17, 2020 at 20:49
    Avatar: Eugenio_Provitera
    Eugenio Provitera
    Participant
    September 21, 2020 at 14:39

    Is there any news about this?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    September 21, 2020 at 15:48

    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

    Avatar: Eugenio_Provitera
    Eugenio Provitera
    Participant
    September 21, 2020 at 16:06

    Perfect work it

    Thank you

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    September 21, 2020 at 16:07

    You are welcome!

    Regards

  • Viewing 7 results - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.