<?php 

function professional_painting_add_admin_menu() {
    add_menu_page(
        'Theme Settings', // Page title
        'Theme Settings', // Menu title
        'manage_options', // Capability
        'professional-painting-theme-settings', // Menu slug
        'professional_painting_settings_page' // Function to display the page
    );
}
add_action( 'admin_menu', 'professional_painting_add_admin_menu' );

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

function professional_painting_register_settings() {
    register_setting( 'professional_painting_settings_group', 'professional_painting_enable_animations' );

    add_settings_section(
        'professional_painting_settings_section',
        __( 'Animation Settings', 'professional-painting' ),
        null,
        'professional-painting-theme-settings'
    );

    add_settings_field(
        'professional_painting_enable_animations',
        __( 'Enable Animations', 'professional-painting' ),
        'professional_painting_enable_animations_callback',
        'professional-painting-theme-settings',
        'professional_painting_settings_section'
    );
}
add_action( 'admin_init', 'professional_painting_register_settings' );

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

