Answer the question
In order to leave comments, you need to log in
How to replace h2 tags in product titles in Woocommerce with divs?
Good afternoon. I really need help.
In Woocommerce, product names are displayed wrapped in an h2 tag. How to correctly replace it with a div?
Answer the question
In order to leave comments, you need to log in
I did this, only changed to H3, correct for yourself on div
/**
* Переопределяем функцию, т.к. нет из нее фильтра, а тег h2 надо поменять на h3
*/
if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) {
/**
* Show the product title in the product loop. By default this is an H2.
*/
function woocommerce_template_loop_product_title() {
echo '<h3 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h3>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question