Skip to content

Instantly share code, notes, and snippets.

@patrickposner
Created April 15, 2020 18:45
Show Gist options
  • Select an option

  • Save patrickposner/7612264aea95ee747cbbe7cd8bbd3c58 to your computer and use it in GitHub Desktop.

Select an option

Save patrickposner/7612264aea95ee747cbbe7cd8bbd3c58 to your computer and use it in GitHub Desktop.
Modify shop loop item title markup
<?php
// first unhook the title.
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title' );
// then hook your own.
add_action( 'woocommerce_shop_loop_item_title', 'pp_custom_title', 30 );
/**
* Modify the template loop title markup
*
* @return void
*/
function pp_custom_title() {
$tag = 'p';
echo '<' . esc_html( $tag ) . ' class="woocommerce-loop-product__title"><a href="' . esc_url( get_permalink() ) . '">' . get_the_title() . '</a></' . esc_html( $tag ) . '>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment