/*
Theme Name: Restaurant And Cafe Pro Child
Template: restaurant-and-cafe-pro
Version: 1.0
*/

<?php
// Enqueue parent styles
add_action( 'wp_enqueue_scripts', 'rac_pro_child_enqueue_styles' );
function rac_pro_child_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

// Diagnostic: Find which actions are hooked to 'homepage'
add_action( 'homepage', 'diagnostic_homepage_actions', 1 );
function diagnostic_homepage_actions() {
    global $wp_filter;
    if ( isset( $wp_filter['homepage'] ) ) {
        echo '<pre style="background:#fff; padding:10px; border:1px solid red; position:fixed; top:10px; right:10px; z-index:99999; max-height:80vh; overflow:auto;">';
        echo "Homepage Sections Found:<br>";
        foreach ( $wp_filter['homepage']->callbacks as $priority => $actions ) {
            foreach ( $actions as $action => $data ) {
                echo "Priority: <strong>$priority</strong> → " . $action . "<br>";
            }
        }
        echo '</pre>';
    }
}

// Remove default testimonial (trying multiple common priorities)
add_action( 'wp', 'remove_rara_testimonials' );
function remove_rara_testimonials() {
    remove_action( 'homepage', 'rara_testimonial_section', 60 );
    remove_action( 'homepage', 'rara_testimonial_section', 65 );
    remove_action( 'homepage', 'rara_testimonial_section', 70 );
    remove_action( 'homepage', 'rara_testimonial_section', 75 );
    remove_action( 'homepage', 'rara_testimonial_section', 80 );
}

// Add Google Reviews
add_action( 'homepage', 'custom_google_reviews_section', 75 );
function custom_google_reviews_section() {
    ?>
    <section id="google-reviews-section" class="google-reviews-section">
        <div class="container">
            <h2 class="section-title">What Our Customers Say</h2>
            <?php echo do_shortcode('[grw id=854]'); ?>
        </div>
    </section>
    <?php
}
.google-reviews-section {
    padding: 80px 0;
    background: #f9f9f9;
}

.google-reviews-section .section-title {
    text-align: center;
    margin-bottom: 40px;
}

.google-reviews-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}