Archived topic
Set titles of posts to p
3 replies · Started by Vijay on July 24, 2022
When I visit a WooCommerce Product Tag archive page, each of the 100 posts tagged 'Chrysler building' have a H2 (with a class .woocommerce-loop-product__title)
Is there some code I can add to display these as P or DIV rather than as H2s?
or can I configure this via Customizer?
Hi there,
the Theme doesn't interfere with the Woocommerce templates, and that element tag is hardcoded in the woo function - see here:
You can simply overwrite that function like so by adding your own copy in your child theme functions.php eg.
function woocommerce_template_loop_product_title() {
echo '<div class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
But do you want this only on that specific archive page ?
Thanks David, that did the trick
Glad to hear that!