Showing product attribute as subtitle
-
I’d like to be able to show the product attribute as the subtitle. Is there any way I can do this? I’ve got it to work with the product title, but I don’t know the specific function to call to make this work with this plugin. I’m very new to PHP so please help me. Thank you.
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’, 5 );
add_action( ‘woocommerce_single_product_summary’, ‘custom_template_single_title’, 5 );
function custom_template_single_title() {
global $product;$brand_name = $product->get_attribute(‘book-author’);
echo ‘<h1 class=”product_title entry-title”>’;
the_title();
if( $brand_name )
echo (” by “) . $brand_name;
echo ‘</h1>’;
}
- The topic ‘Showing product attribute as subtitle’ is closed to new replies.