Created
April 15, 2020 18:45
-
-
Save patrickposner/7612264aea95ee747cbbe7cd8bbd3c58 to your computer and use it in GitHub Desktop.
Modify shop loop item title markup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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