Question About Developing A Functionality With Brands

This topic has 3 replies, 2 voices, and was last updated 3 years, 5 months ago ago by PYordanovDev

  • Avatar: PYordanovDev
    PYordanovDev
    Participant
    July 2, 2021 at 10:44

    Hi guys,

    I want to say that I’m using XStore’s theme for a month now and it’s going great. I’m looking to further extend the functionality of the Brands and have just a simple line of text indicating the brand on the product instead of an image on it.

    Here’s what I mean: https://www.loom.com/share/0cdd15b2680849a5884f04757f4d93cc

    Please, contact administrator
    for this information.
    2 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    July 2, 2021 at 14:30

    Hello,

    Thank you for using our theme!
    Add the below code to child theme functions.php

    function etheme_single_product_brands() {
    		if ( etheme_xstore_plugin_notice() ) {
    			return;
    		}
    		global $post;
    		$terms = wp_get_post_terms( $post->ID, 'brand' );
    		$brand = etheme_get_option( 'brand_title',1 );
    		if ( count( $terms ) < 1 ) {
    			return;
    		}
    		$_i = 0;
    		?>
            <span class="product_brand">
    			<?php if ( $brand ) {
    				esc_html_e( 'Brand: ', 'xstore' );
    			} ?>
    			<?php foreach ( $terms as $brand ) : $_i ++; ?>
    				<?php
    				$thumbnail_id = absint( get_term_meta( $brand->term_id, 'thumbnail_id', true ) ); ?>
                    <a href="<?php echo get_term_link( $brand ); ?>">
    							<?php echo esc_html( $brand->name ); ?>
    						</a>
    				<?php if ( count( $terms ) > $_i ) {
    					echo ", ";
    				} ?>
    			<?php endforeach; ?>
    			</span>
    		<?php
    	}

    Regards

    Avatar: PYordanovDev
    PYordanovDev
    Participant
    July 2, 2021 at 16:12

    Wow! Thank you! It worked perfectly. You’re awesome and I really appreciate this.

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

The issue related to '‘Question About Developing A Functionality With Brands’' has been successfully resolved, and the topic is now closed for further responses

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