Show only main brand and no sub-brand in website

This topic has 8 replies, 2 voices, and was last updated 1 weeks, 6 days ago ago by Andrew Mitchell

  • Avatar: Corrado Zanetti
    Corrado Zanetti
    Participant
    April 15, 2024 at 15:09

    Hello Dear,

    I need to display only the primary brand and exclude any subsidiary brands, both on individual product pages and within the brand logo slider.

    It’s that possible?

    Please, contact administrator
    for this information.
    Files is visible for topic creator and
    support staff only.
    7 Answers
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    April 16, 2024 at 11:10

    Hello, Corrado,

    To proceed with this, please send us the FTP access details. We need to add custom code to the child theme and modify some files in the plugin.

    Best Regards,
    8Theme’s Team

    Avatar: Corrado Zanetti
    Corrado Zanetti
    Participant
    April 16, 2024 at 11:14

    Thank you, i’ve added in private area content

    Content is visible for topic creator and
    support staff only.
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    April 16, 2024 at 11:39

    We are pleased to inform you that we have introduced a new feature, the “Hide Child Brands” option, for the Brand Carousel Element. This feature will be made available in the upcoming theme update.

    To remove child brands from the single product pages, we have added the following code to the functions.php file of the child theme.

    
    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 );
    	$show_image = etheme_get_option('show_brand_image', 1);
    	if ( count( $terms ) < 1 ) {
    		return;
    	}
    
    	// Initialize an array to hold parent terms
    	$parent_terms = array();
    
    	// Filter out child terms
    	foreach ($terms as $term) {
    	    if ($term->parent == 0) { // Check if the term is a parent
    	        $parent_terms[] = $term; // Add to parent terms array
    	    }
    	}
    
    	$_i = 0;
    	?>
        <span class="product_brand">
    		<?php if ( $brand ) {
    			echo esc_html__( 'Brand: ', 'xstore' );
    		} ?>
    		<?php foreach ( $parent_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 if ( $thumbnail_id && $show_image ) {
    							echo wp_get_attachment_image( $thumbnail_id, 'full' );
    						} else { ?>
    							<?php echo esc_html( $brand->name ); ?>
    						<?php } ?>
    					</a>
    			<?php if ( count( $parent_terms ) > $_i ) {
    				echo ", ";
    			} ?>
    		<?php endforeach; ?>
    		</span>
    	<?php
    }
    

    Should you require any further assistance, please do not hesitate to contact us.

    Best Regards,
    The 8Theme Team

    Files is visible for topic creator and
    support staff only.
    Avatar: Corrado Zanetti
    Corrado Zanetti
    Participant
    April 16, 2024 at 12:01

    Super thanks.
    So when a new update will be available, i need to remove this code in my function and enable the new feature directly on theme options?

    Thanks.

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    April 16, 2024 at 14:42

    We are pleased to inform you that the updated version has been successfully transferred to you. There is no action required on your part. Additionally, please be assured that there is no need to remove the code from the child theme, as it is responsible for the modifications made to the brand for the single product.

    Best Regards,
    The 8Theme Team

    Avatar: Corrado Zanetti
    Corrado Zanetti
    Participant
    April 16, 2024 at 15:04

    Oh perfect, thank you!

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    April 16, 2024 at 15:04

    Dear Corrado Zanetti,

    Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?

    Click here to share your insights: https://themeforest.net/downloads

    Your support fuels our journey, and we appreciate it more than words can express.

    Best Regards,
    The 8Theme Team

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

The issue related to '‘Show only main brand and no sub-brand in website’' 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.