<?php 

function water_sports_rental_add_admin_menu() {
    add_menu_page(
        'Theme Settings', // Page title
        'Theme Settings', // Menu title
        'manage_options', // Capability
        'water-sports-rental-theme-settings', // Menu slug
        'water_sports_rental_settings_page' // Function to display the page
    );
}
add_action( 'admin_menu', 'water_sports_rental_add_admin_menu' );

function water_sports_rental_settings_page() {
    ?>
    <div class="wrap">
        <h1><?php esc_html_e( 'Theme Settings', 'water-sports-rental' ); ?></h1>
        <form action="options.php" method="post">
            <?php
            settings_fields( 'water_sports_rental_settings_group' );
            do_settings_sections( 'water-sports-rental-theme-settings' );
            submit_button();
            ?>
        </form>
    </div>
    <?php
}

function water_sports_rental_register_settings() {
    register_setting( 'water_sports_rental_settings_group', 'water_sports_rental_enable_animations' );

    add_settings_section(
        'water_sports_rental_settings_section',
        __( 'Animation Settings', 'water-sports-rental' ),
        null,
        'water-sports-rental-theme-settings'
    );

    add_settings_field(
        'water_sports_rental_enable_animations',
        __( 'Enable Animations', 'water-sports-rental' ),
        'water_sports_rental_enable_animations_callback',
        'water-sports-rental-theme-settings',
        'water_sports_rental_settings_section'
    );
}
add_action( 'admin_init', 'water_sports_rental_register_settings' );

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

