Answer the question
In order to leave comments, you need to log in
How to change product list markup in woocommerce?
Goodnight. In the catalog of goods I want to set a class for the names of goods. In the file content-product.php
, this hook is responsible for displaying the name woocommerce_template_loop_product_title
. And it is located along the path includes/wc-template-functions.php . Here is the piece of code itself:
/**
* Show the product title in the product loop. By default this is an H3.
*/
function woocommerce_template_loop_product_title() {
echo '<h3>' . get_the_title() . '</h3>';
}
Answer the question
In order to leave comments, you need to log in
Delete the woo hook. You add a new one with a link to your function. This can be placed in functions.php
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
add_action( 'woocommerce_shop_loop_item_title', 'custom_woocommerce_template_loop_product_title', 10 );
function custom_woocommerce_template_loop_product_title() {
echo '<h3 class="myclass">' . get_the_title() . '</h3>';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question