Wordpress - anyone know how to force the Brands Description?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Wordpress - anyone know how to force the Brands Description?

Post by simonmlewis »

We have a theme that sadly does not support the "description" of a brand on the Brands webpage.
I have looked it up but it does look a bit confusing and I can find no definitive "how to" to get it on there.

Any ideas?

We are using the ultimate brands woocommerce plugin.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Wordpress - anyone know how to force the Brands Descript

Post by Celauran »

Is it not showing anywhere or just on a particular page? Does it display if you switch to another theme? I looked quickly and the functionality appears to be provided by the plugin, not the theme.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Wordpress - anyone know how to force the Brands Descript

Post by simonmlewis »

The idea is that it should show on the Brand page, that shows all products for that particular brand.

...../brands/emile-et-rose/.

As you say, it's supported by the plugin and not the theme. Some themes allow it and some are not configured for it. I guess it's some code that is missing...
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Wordpress - anyone know how to force the Brands Descript

Post by Celauran »

Don't have a ton of time to look into it right now -- though I can peek tonight if you haven't resolved it. Meanwhile, I can see that brand descriptions are stored in wp_term_taxonomy, so I'd look at get_terms() and related functions. Hope that gets you pointed in the right direction.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Wordpress - anyone know how to force the Brands Descript

Post by simonmlewis »

I found this earler to go on the product page, so each brand will show it's descrption on any product that uses it.
Be useful it I could do similar for the Brands own page?

Code: Select all

add_action( 'woocommerce_single_product_summary' , 'woocommerce_brand_summary', 25 );

/**
 * woocommerce_brand_summary
 *
 * @access      public
 * @since       1.0 
 * @return      void
*/
function woocommerce_brand_summary() {
	
	global $post;
	
	$brands = wp_get_post_terms( $post->ID, 'product_brand', array("fields" => "all") );

	foreach( $brands as $brand ) {
		echo __( 'Brand Description', '') . ': ' . term_description( $brand->term_id, 'product_brand' );
	}
	
}
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply