esc_html__('Primary Menu', 'nonprofit-starter'),
        'footer'  => esc_html__('Footer Menu', 'nonprofit-starter'),
    ]);

    // Switch default core markup to output valid HTML5
    add_theme_support('html5', [
        'search-form',
        'comment-form',
        'comment-list',
        'gallery',
        'caption',
        'style',
        'script',
    ]);

    // Add theme support for selective refresh for widgets
    add_theme_support('customize-selective-refresh-widgets');

    // Add support for editor styles
    add_theme_support('editor-styles');
    
    // Enqueue editor styles
    add_editor_style('style.css');

    // Add support for responsive embedded content
    add_theme_support('responsive-embeds');

    // Add support for wide and full alignment
    add_theme_support('align-wide');

    // Add support for custom line height controls
    add_theme_support('custom-line-height');

    // Add support for custom spacing controls
    add_theme_support('custom-spacing');

    // Add support for custom units
    add_theme_support('custom-units');

    // Add support for block styles
    add_theme_support('wp-block-styles');
}
add_action('after_setup_theme', 'nonprofit_starter_setup');

/**
 * Set the content width in pixels
 */
function nonprofit_starter_content_width(): void {
    $GLOBALS['content_width'] = apply_filters('nonprofit_starter_content_width', 1200);
}
add_action('after_setup_theme', 'nonprofit_starter_content_width', 0);

/**
 * Enqueue scripts and styles
 */
function nonprofit_starter_scripts(): void {
    // Enqueue main stylesheet
    wp_enqueue_style(
        'nonprofit-starter-style',
        get_stylesheet_uri(),
        [],
        wp_get_theme()->get('Version')
    );

    // Enqueue main JavaScript file
    wp_enqueue_script(
        'nonprofit-starter-main',
        get_template_directory_uri() . '/assets/js/main.js',
        [],
        wp_get_theme()->get('Version'),
        true
    );

    // Enqueue comment reply script on single posts
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
}
add_action('wp_enqueue_scripts', 'nonprofit_starter_scripts');

/**
 * Register widget areas
 */
function nonprofit_starter_widgets_init(): void {
    register_sidebar([
        'name'          => esc_html__('Sidebar', 'nonprofit-starter'),
        'id'            => 'sidebar-1',
        'description'   => esc_html__('Add widgets here to appear in your sidebar.', 'nonprofit-starter'),
        'before_widget' => '
',
        'after_widget'  => '
',
        'before_title'  => '
',
        'after_title'   => '
',
    ]);

    register_sidebar([
        'name'          => esc_html__('Footer', 'nonprofit-starter'),
        'id'            => 'footer-1',
        'description'   => esc_html__('Add widgets here to appear in your footer.', 'nonprofit-starter'),
        'before_widget' => '
',
        'after_widget'  => '
',
        'before_title'  => '
',
        'after_title'   => '
',
    ]);
}
add_action('widgets_init', 'nonprofit_starter_widgets_init');

/**
 * Register Custom Post Type: Events
 * Perfect for nonprofit organizations to showcase upcoming events
 */
function nonprofit_starter_register_events_cpt(): void {
    $labels = [
        'name'                  => _x('Events', 'Post Type General Name', 'nonprofit-starter'),
        'singular_name'         => _x('Event', 'Post Type Singular Name', 'nonprofit-starter'),
        'menu_name'             => __('Events', 'nonprofit-starter'),
        'name_admin_bar'        => __('Event', 'nonprofit-starter'),
        'archives'              => __('Event Archives', 'nonprofit-starter'),
        'attributes'            => __('Event Attributes', 'nonprofit-starter'),
        'parent_item_colon'     => __('Parent Event:', 'nonprofit-starter'),
        'all_items'             => __('All Events', 'nonprofit-starter'),
        'add_new_item'          => __('Add New Event', 'nonprofit-starter'),
        'add_new'               => __('Add New', 'nonprofit-starter'),
        'new_item'              => __('New Event', 'nonprofit-starter'),
        'edit_item'             => __('Edit Event', 'nonprofit-starter'),
        'update_item'           => __('Update Event', 'nonprofit-starter'),
        'view_item'             => __('View Event', 'nonprofit-starter'),
        'view_items'            => __('View Events', 'nonprofit-starter'),
        'search_items'          => __('Search Event', 'nonprofit-starter'),
        'not_found'             => __('Not found', 'nonprofit-starter'),
        'not_found_in_trash'    => __('Not found in Trash', 'nonprofit-starter'),
        'featured_image'        => __('Featured Image', 'nonprofit-starter'),
        'set_featured_image'    => __('Set featured image', 'nonprofit-starter'),
        'remove_featured_image' => __('Remove featured image', 'nonprofit-starter'),
        'use_featured_image'    => __('Use as featured image', 'nonprofit-starter'),
        'insert_into_item'      => __('Insert into event', 'nonprofit-starter'),
        'uploaded_to_this_item' => __('Uploaded to this event', 'nonprofit-starter'),
        'items_list'            => __('Events list', 'nonprofit-starter'),
        'items_list_navigation' => __('Events list navigation', 'nonprofit-starter'),
        'filter_items_list'     => __('Filter events list', 'nonprofit-starter'),
    ];

    $args = [
        'label'                 => __('Event', 'nonprofit-starter'),
        'description'           => __('Nonprofit events and programs', 'nonprofit-starter'),
        'labels'                => $labels,
        'supports'              => ['title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'custom-fields'],
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-calendar-alt',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'capability_type'       => 'post',
        'show_in_rest'          => true, // Enable Gutenberg editor
        'rest_base'             => 'events',
        'rewrite'               => [
            'slug'       => 'events',
            'with_front' => false,
        ],
    ];

    register_post_type('event', $args);
}
add_action('init', 'nonprofit_starter_register_events_cpt');

/**
 * Add custom excerpt length
 */
function nonprofit_starter_excerpt_length(int $length): int {
    return 30;
}
add_filter('excerpt_length', 'nonprofit_starter_excerpt_length');

/**
 * Change excerpt more string
 */
function nonprofit_starter_excerpt_more(string $more): string {
    return '...';
}
add_filter('excerpt_more', 'nonprofit_starter_excerpt_more');

/**
 * Add body classes for better styling control
 */
function nonprofit_starter_body_classes(array $classes): array {
    // Add a class if sidebar is active
    if (is_active_sidebar('sidebar-1')) {
        $classes[] = 'has-sidebar';
    }

    // Add page slug to body class
    if (is_page()) {
        global $post;
        $classes[] = 'page-' . $post->post_name;
    }

    return $classes;
}
add_filter('body_class', 'nonprofit_starter_body_classes');

/**
 * Custom template tags for this theme
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Add custom query vars for events filtering
 */
function nonprofit_starter_query_vars(array $vars): array {
    $vars[] = 'event_date';
    return $vars;
}
add_filter('query_vars', 'nonprofit_starter_query_vars');<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://studiotuesday.dev/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://studiotuesday.dev/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://studiotuesday.dev/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://studiotuesday.dev/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://studiotuesday.dev/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>