Skip to content

Instantly share code, notes, and snippets.

@melvinstanly
Created February 15, 2019 04:37
Show Gist options
  • Save melvinstanly/4b3315429fe85391ab494c54fbab3833 to your computer and use it in GitHub Desktop.
Save melvinstanly/4b3315429fe85391ab494c54fbab3833 to your computer and use it in GitHub Desktop.
Woocommerce Product titles
<?php
// Change product title for products in shop page
remove_action( 'woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title', 10 );
function change_product_title() {
$additional_text = ' More info';
echo '<h2 class="woocommerce-loop-product__title">' . get_the_title() .$additional_text.'</h2>';
}
add_action('woocommerce_shop_loop_item_title','change_product_title');
// Change product title in single product page
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
function woocommerce_template_single_title_custom(){
$additional_text = ' More Info';
the_title( '<h3 class="product_title entry-title">', $additional_text.'</h3>' );
}
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title_custom', 5);
// <?php the_title( $before, $after, $echo ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment