<?php 

function glam_fashion_add_admin_menu() {
    add_menu_page(
        'Theme Settings', // Page title
        'Theme Settings', // Menu title
        'manage_options', // Capability
        'glam-fashion-blog-theme-settings', // Menu slug
        'glam_fashion_settings_page' // Function to display the page
    );
}
add_action( 'admin_menu', 'glam_fashion_add_admin_menu' );

function glam_fashion_settings_page() {
    ?>
    <div class="wrap">
        <h1><?php esc_html_e( 'Theme Settings', 'glam-fashion-blog' ); ?></h1>
        <form action="options.php" method="post">
            <?php
            settings_fields( 'glam_fashion_settings_group' );
            do_settings_sections( 'glam-fashion-blog-theme-settings' );
            submit_button();
            ?>
        </form>
    </div>
    <?php
}

function glam_fashion_register_settings() {
    register_setting( 'glam_fashion_settings_group', 'glam_fashion_enable_animations' );

    add_settings_section(
        'glam_fashion_settings_section',
        __( 'Animation Settings', 'glam-fashion-blog' ),
        null,
        'glam-fashion-blog-theme-settings'
    );

    add_settings_field(
        'glam_fashion_enable_animations',
        __( 'Enable Animations', 'glam-fashion-blog' ),
        'glam_fashion_enable_animations_callback',
        'glam-fashion-blog-theme-settings',
        'glam_fashion_settings_section'
    );
}
add_action( 'admin_init', 'glam_fashion_register_settings' );

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

