<?php 

function golf_country_club_add_admin_menu() {
    add_menu_page(
        'Theme Settings', // Page title
        'Theme Settings', // Menu title
        'manage_options', // Capability
        'golf-country-club-theme-settings', // Menu slug
        'golf_country_club_settings_page' // Function to display the page
    );
}
add_action( 'admin_menu', 'golf_country_club_add_admin_menu' );

function golf_country_club_settings_page() {
    ?>
    <div class="wrap">
        <h1><?php esc_html_e( 'Theme Settings', 'golf-country-club' ); ?></h1>
        <form action="options.php" method="post">
            <?php
            settings_fields( 'golf_country_club_settings_group' );
            do_settings_sections( 'golf-country-club-theme-settings' );
            submit_button();
            ?>
        </form>
    </div>
    <?php
}

function golf_country_club_register_settings() {
    register_setting( 'golf_country_club_settings_group', 'golf_country_club_enable_animations' );

    add_settings_section(
        'golf_country_club_settings_section',
        __( 'Animation Settings', 'golf-country-club' ),
        null,
        'golf-country-club-theme-settings'
    );

    add_settings_field(
        'golf_country_club_enable_animations',
        __( 'Enable Animations', 'golf-country-club' ),
        'golf_country_club_enable_animations_callback',
        'golf-country-club-theme-settings',
        'golf_country_club_settings_section'
    );
}
add_action( 'admin_init', 'golf_country_club_register_settings' );

function golf_country_club_enable_animations_callback() {
    $checked = get_option( 'golf_country_club_enable_animations', true );
    ?>
    <input type="checkbox" name="golf_country_club_enable_animations" value="1" <?php checked( 1, $checked ); ?> />
    <?php
}

