Change product title to a hooked function. Fixes #8601

This commit is contained in:
Jodi Warren 2015-07-20 18:10:56 +01:00
parent 6781f37fed
commit 2fb5f5bf78
4 changed files with 33 additions and 1 deletions

View File

@ -507,6 +507,14 @@ if ( ! function_exists( 'woocommerce_product_loop_end' ) ) {
return ob_get_clean();
}
}
if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) {
/**
* Show the product title in the product loop. By default this is an H3
*/
function woocommerce_template_loop_product_title() {
wc_get_template( 'loop/title.php' );
}
}
if ( ! function_exists( 'woocommerce_taxonomy_archive_description' ) ) {
/**

View File

@ -88,6 +88,7 @@ add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 )
*/
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );

View File

@ -58,7 +58,15 @@ if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] ) {
do_action( 'woocommerce_before_shop_loop_item_title' );
?>
<h3><?php the_title(); ?></h3>
<?php
/**
* woocommerce_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_product_title - 10
*/
do_action( 'woocommerce_shop_loop_item_title' );
?>
<?php
/**

15
templates/loop/title.php Normal file
View File

@ -0,0 +1,15 @@
<?php
/**
* Single Product title
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.5
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<h3><?php the_title(); ?></h3>