I need help changing text to H2 in Elementor with Wordpress.

VibroHeavenUK

Power Member
Apr 18, 2021
611
337

I really hope this makes sense as I'm not 100% sure I'm describing it right, sorry.

I'm using Elementor with Wordpress and inserting sections like the one in the photo with images and using the image caption for the photo description but I'm thinking these would be better set as H2 headings for SEO but I have no idea how to change it. It doesn't help when I don't know how to describe it!

I hope that makes sense.

Thanks in advance,
 
Are those woocommerce products? Or are you using text module to create those?

I personally disagree changing those titles to h2 will help your SEO. H2 is a sub heading and there’s supposed to be at least a paragraph of text under it. Using h2 that way is not the correct way to use h2.
 
Are those woocommerce products? Or are you using text module to create those?

I personally disagree changing those titles to h2 will help your SEO. H2 is a sub heading and there’s supposed to be at least a paragraph of text under it. Using h2 that way is not the correct way to use h2.

Its Woocommerce products, I never realised H2 needed extra text, thanks for that, you learn something new everyday.
 

I really hope this makes sense as I'm not 100% sure I'm describing it right, sorry.

I'm using Elementor with Wordpress and inserting sections like the one in the photo with images and using the image caption for the photo description but I'm thinking these would be better set as H2 headings for SEO but I have no idea how to change it. It doesn't help when I don't know how to describe it!

I hope that makes sense.

Thanks in advance,
You need to edit that in the Theme files.

Access it from Appearance -> Editor. Choose the respective .php file (since you are saying it is your home page, it should be at index.php). Identify the HTML h1 tag and change it to h2.

Site description code is most probably available at header.php.

It would be good if you gave the name of the theme you are using for your site, for a more specific solution.
 
You need to edit that in the Theme files.

Access it from Appearance -> Editor. Choose the respective .php file (since you are saying it is your home page, it should be at index.php). Identify the HTML h1 tag and change it to h2.

Site description code is most probably available at header.php.

It would be good if you gave the name of the theme you are using for your site, for a more specific solution.
Bad idea to update theme files. If you do that, you lose the changes when you update the theme. Always use child themes, and override just the file you need to.
 
Its Woocommerce products, I never realised H2 needed extra text, thanks for that, you learn something new everyday.
Yes. H2 should be reserved for articles. I have several ecom websites using woocomemerce. I change those titles you want to change to <span> tags.

You must add the code below to your functions.php theme file. As @Gogol mentioned, you need to use a child theme for this, otherwise the next time you update your theme, this will be overwritten.

Look in the code below for the opening and closing <span> tags. Change that to whatever HTML tag you want and it will work.

Code:
remove_action( 'woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title', 10 );
add_action('woocommerce_shop_loop_item_title', 'soChangeProductsTitle', 10 );
function soChangeProductsTitle() {
    echo '<span class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</span>';
}
 
Last edited:
If you want to style those titles after you update your functions.php file you can use css. You can add css in a couple of different places. I like to do it in appearance > customize > additional CSS

Code:
.woocommerce-loop-product__title {
font-weight: 600;
}

This will make all the titles you changed bold.

If you dont know much CSS, its easy to learn starting here: https://developer.mozilla.org/en-US/docs/Web/CSS
 
Last edited:
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock