Home Forums Themes Support How to change Heading tag in HaruTheme

Tagged: 

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #10537

    Hi all customers,

    In this topic tutorial we’ll help you change Heading tag (h1, h2, h3, h4, h5, h6) if you want to change it for optimize SEO.

    Step 1: First of all you need to understand how to use customize template display via child theme follow this topic:

    https://harutheme.com/forums/topic/customize-wordpress-theme-using-child-theme/

    Why you need to use child theme to do this? Because if you override the code directly in our theme (parent theme), all of your customization will lost when you update our theme & plugins to the latest version.

    Step 2: After understand how to customize template display you can change heading of Widgets (Shortcodes,…) or template display of theme (WooCommerce, Blog,…)

    Example(s):

    • Template display of Icon Box in: wp-content/plugins/haru-xxx-core/templates/icon-box/style_1.php (or other style depend on your settings)
    • Template display of Haru Banner in: wp-content/plugins/haru-xxx-core/templates/banner/style_1.php (or other style depend on your settings)
    • Template display of Haru Footer Link in: wp-content/plugins/haru-xxx-core/templates/footer/footer-link/style_1.php (or other style depend on your settings)
    • Template display of archive product (Shop) in: wp-content/themes/pangja/woocommerce/archive-product.php (Example is pangja, you can change to another theme name folder)

    Step 3: With some special heading like product title of WooCommerce you can’t override via template of child theme, so you need to use custom action via functions.php of child theme:

    Example (s):

    /**
     * Show the product title in the product loop. By default this is an H2.
     */
    function action_woocommerce_shop_loop_item_title() {
        // Removes a function from a specified action hook.
        remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
        
        echo '<h6 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h6>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    }
    add_action( 'woocommerce_shop_loop_item_title', 'action_woocommerce_shop_loop_item_title', 9 );

    Reference more here: https://stackoverflow.com/questions/62777942/changing-woocommerce-template-loop-product-title-heading-tag

    Thanks for your reading & Hope this helps!

     

    ****
    Best Regards,

    HaruTheme

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.