<?php 

function scholarship_school_add_admin_menu() {
    add_menu_page(
        'Theme Settings', // Page title
        'Theme Settings', // Menu title
        'manage_options', // Capability
        'scholarship-school-theme-settings', // Menu slug
        'scholarship_school_settings_page' // Function to display the page
    );
}
add_action( 'admin_menu', 'scholarship_school_add_admin_menu' );

function scholarship_school_settings_page() {
    ?>
    <div class="wrap">
        <h1><?php esc_html_e( 'Theme Settings', 'scholarship-school' ); ?></h1>
        <form action="options.php" method="post">
            <?php
            settings_fields( 'scholarship_school_settings_group' );
            do_settings_sections( 'scholarship-school-theme-settings' );
            submit_button();
            ?>
        </form>
    </div>
    <?php
}

function scholarship_school_register_settings() {
    register_setting( 'scholarship_school_settings_group', 'scholarship_school_enable_animations' );

    add_settings_section(
        'scholarship_school_settings_section',
        __( 'Animation Settings', 'scholarship-school' ),
        null,
        'scholarship-school-theme-settings'
    );

    add_settings_field(
        'scholarship_school_enable_animations',
        __( 'Enable Animations', 'scholarship-school' ),
        'scholarship_school_enable_animations_callback',
        'scholarship-school-theme-settings',
        'scholarship_school_settings_section'
    );
}
add_action( 'admin_init', 'scholarship_school_register_settings' );

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

