// ===== CREATE ALL PAGES ON THEME ACTIVATION =====
function vahanmilap_create_all_pages() {
    $pages = array(
        'about' => array(
            'title' => 'About Us',
            'template' => 'page-about.php',
            'content' => ''
        ),
        'process' => array(
            'title' => 'How It Works',
            'template' => 'page-process.php',
            'content' => ''
        ),
        'projects' => array(
            'title' => 'Project Board',
            'template' => 'page-projects.php',
            'content' => ''
        ),
        'features' => array(
            'title' => 'Features',
            'template' => 'page-features.php',
            'content' => ''
        ),
        'pricing' => array(
            'title' => 'Pricing',
            'template' => 'page-pricing.php',
            'content' => ''
        ),
        'contact' => array(
            'title' => 'Contact Us',
            'template' => 'page-contact.php',
            'content' => ''
        ),
        'faq' => array(
            'title' => 'Frequently Asked Questions',
            'template' => 'page-faq.php',
            'content' => ''
        ),
        'terms' => array(
            'title' => 'Terms & Conditions',
            'template' => 'page-terms.php',
            'content' => ''
        ),
        'privacy' => array(
            'title' => 'Privacy Policy',
            'template' => 'page-privacy.php',
            'content' => ''
        ),
        'login' => array(
            'title' => 'Login',
            'template' => 'page-login.php',
            'content' => ''
        ),
        'register' => array(
            'title' => 'Register',
            'template' => 'page-register.php',
            'content' => ''
        )
    );
    
    foreach ($pages as $slug => $page) {
        $existing_page = get_page_by_path($slug);
        
        if (!$existing_page) {
            $page_id = wp_insert_post(array(
                'post_title' => $page['title'],
                'post_name' => $slug,
                'post_status' => 'publish',
                'post_type' => 'page',
                'post_content' => $page['content'],
                'post_author' => 1
            ));
            
            if ($page_id && !is_wp_error($page_id)) {
                update_post_meta($page_id, '_wp_page_template', $page['template']);
            }
        } else {
            // Update existing page to use correct template
            update_post_meta($existing_page->ID, '_wp_page_template', $page['template']);
        }
    }
    
    flush_rewrite_rules();
}
add_action('after_switch_theme', 'vahanmilap_create_all_pages');
add_action('init', 'vahanmilap_create_all_pages');<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://vahanmilap.in/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://vahanmilap.in/wp-sitemap-posts-page-1.xml</loc></sitemap></sitemapindex>
