• Resolved folele

    (@folele)


    Hello!

    I am working on the SEO of my website and WooCommerce related products shows themselves as H2. How I can change them into H3?

    I saw this topic in the forum and I tried to apply the solution, copying the code with my Code Snippets plug-in, but the plug-in told me that it is disabled because there is an error in the second line of the code: “Cannot redeclarate function woocommerce_template_loop_product_title“.

    This is the code I copy:
    function woocommerce_template_loop_product_title() { echo ‘<h3 class=”woocommerce-loop-product__title”>’ . get_the_title() . ‘</h3>’; }

    I am brand new in WordPress and I use Code Snippet to copy/paste the codes that I need.

    Thank you so much for your attention and help

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

Viewing 1 replies (of 1 total)
  • This is because the code is running after WooCommerce has created the function, so the function can’t be redeclared. You need to run it before WooCommerce creates the function. If so, WooCommerce will realise that the function already exists and so not try to create it a second time.

    In order to run your function first, you’ll need to make a child theme and put the code in functions.php for the child theme.

    The first line in functions.php must be to start up the php interpreter with:

    <?php

    Code Snippets is good but its not always the right tool.

Viewing 1 replies (of 1 total)
  • The topic ‘Change H2 to H3’ is closed to new replies.