<?php
/**
* Theme Name: Blonwe Child
* Description: This is a child theme of Blonwe, generated by Merlin WP.
* Author: <a href="http://themeforest.net/user/KlbTheme">KlbTheme (Sinan ISIK)</a>
* Template: blonwe
* Version: 1.2.9
*/

// --- START OF CUSTOM OVERRIDE CODE ---

ction blonwe_bruteforce_replace_product_title() {
    // 1. Clear ALL functions hooked to woocommerce_shop_loop_item_title
    // This removes the theme's stubborn H2 function, whatever its name may be.
    remove_all_actions( 'woocommerce_shop_loop_item_title' );

    // 2. Add our own custom function back to the hook.
    // We use a high priority (999) to ensure it runs last and overrides anything else.
    add_action( 'woocommerce_shop_loop_item_title', 'blonwe_bruteforce_loop_product_title', 999 );

    // 3. Define the custom function to output the H3 tag
    function blonwe_bruteforce_loop_product_title() {
        // Output the title as an H3, using the class you identified for styling
        echo '<h3 class="product-title">';
        echo '<a href="' . esc_url( get_the_permalink() ) . '">' . get_the_title() . '</a>';
        echo '</h3>';
    }

    // 4. Also aggressively replace the Single Product Title (H1) for SEO integrity.
    // Clears the single product title hook
    remove_all_actions( 'woocommerce_single_product_summary' );
    
    // Add our function to re-hook the necessary elements, including our H1 title
    add_action( 'woocommerce_single_product_summary', 'blonwe_rehook_single_product_summary', 5 );

    function blonwe_rehook_single_product_summary() {
        global $product;

        // Re-hook H1 Title
        echo '<h1 class="product-title entry-title">';
        the_title();
        echo '</h1>';

        // Re-hook other essential elements with their standard priorities/functions.
        woocommerce_template_single_rating();      // 10
        woocommerce_template_single_price();       // 10
        woocommerce_template_single_excerpt();     // 20
        woocommerce_template_single_add_to_cart(); // 30
        woocommerce_template_single_meta();        // 40
        woocommerce_template_single_sharing();     // 50
    }
}
// Run this function late to catch all definitions from the theme
add_action( 'wp_loaded', 'blonwe_bruteforce_replace_product_title' );


// --- END OF CUSTOM OVERRIDE CODE ---








