• Resolved neilorourke

    (@neilorourke)


    Hi,

    I know how to edit the layout of the Woocommerce product template using functions.php but am not sure how to edit the actual markup.

    The main heading above the image in my product pages should be H1 rather than H2.

    Does anyone know how I can change this? I assume this is ‘woocommerce_template_single_title’

    Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • One way would be to copy:
    plugins/woocommerce/templates/single-product/title.php
    to
    themes/your-child-theme/woocommerce/single-product/title.php
    then edit the copy.

    Or, you could unhook the title hook:
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
    and replace it with an add-action() to your own function for the title. The hook name and priority may be different if your theme already has an override, but the method avoids the need to customise and maintain a template. In this case, the code goes in functions.php.

    Thread Starter neilorourke

    (@neilorourke)

    Thanks for your advice. The specific issue I have is that the product title on the page displays in <h2> tags rather than <h1>. Even though the code in the title.php is:

    the_title( ‘<h1 class=”product_title entry-title”>’, ‘</h1>’ );

    I checked my functions.php and ‘woocommerce_template_single_title’ has not been removed.

    Neil

    Do you have a template override? If so it will be at:
    themes/your-child-theme/woocommerce/single-product/title.php

    Also, any template overrides will be listed at:
    Dashboard > WooCommerce > Status

    Thread Starter neilorourke

    (@neilorourke)

    I’m not using a child theme and there are no template overrides listed.

    I’ve looked at the markup for your product pages and the divs, the order of the divs and the element classnames are different from standard, so it does look like your theme is implementing a template override by some method. Also, it looks like you have a custom theme so, unlike www.remarpro.com themes, the code is not available to forum members, and without examining that I don’t thinks its possible to say how to change the h2s.

    Thread Starter neilorourke

    (@neilorourke)

    Hi, thanks for looking into this.

    This is a custom theme I built so will need to track back on how I built this to see where this issue may have arisen.

    I will consider re-installing Woocomerce to see if this flushes out the problem.

    Thanks

    Neil

    Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    Looks like you’ve at least got a place to start looking at this, with some solid advice from lorro.

    Sorry but I’m worried my product pages are showing the product name in H2. Can anyone have a look for me and see if I’m doing something wrong on one of the products I have created? Desperately trying everything and nothing seems to be working for me?

    The product page, if anyone is interested, is https://www.ukpavingsupplies.co.uk/product/marshalls-drivesett-argent-light/
    thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Changing h2 to h1 on woocommerce product page’ is closed to new replies.