<div class="theme-offer">
	<?php
        // Check if the demo import has been completed
        $ecommerce_landing_page_demo_import_completed = get_option('ecommerce_landing_page_demo_import_completed', false);

        // If the demo import is completed, display the "View Site" button
        if ($ecommerce_landing_page_demo_import_completed) {
        echo '<p class="notice-text">' . esc_html__('Your demo import has been completed successfully.', 'ecommerce-landing-page') . '</p>';
        echo '<span><a href="' . esc_url(home_url()) . '" class="button button-primary site-btn" target="_blank">' . esc_html__('View Site', 'ecommerce-landing-page') . '</a></span>';
        echo '<span><a href="'. esc_url(admin_url('customize.php') ) .'" class="button button-primary demo-btn" target=_blank>'. esc_html__( 'Customize Your Site', 'medical-landing-page' ) .'</a></span>';
        echo '<span><a href="'. esc_url( 'https://preview.vwthemesdemo.com/docs/free-medical-landing-page/' ) .'" class="button button-primary doc-btn" target=_blank>'. esc_html__( 'Free Theme Documentation', 'medical-landing-page' ) .'</a></span>';
        }

		//POST and update the customizer and other related data
        if (isset($_POST['submit'])) {

            // Check if ibtana visual editor is installed and activated
            if (!is_plugin_active('ibtana-visual-editor/plugin.php')) {
              // Install the plugin if it doesn't exist
              $medical_landing_page_plugin_slug = 'ibtana-visual-editor';
              $medical_landing_page_plugin_file = 'ibtana-visual-editor/plugin.php';

              // Check if plugin is installed
              $medical_landing_page_installed_plugins = get_plugins();
              if (!isset($medical_landing_page_installed_plugins[$medical_landing_page_plugin_file])) {
                  include_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
                  include_once(ABSPATH . 'wp-admin/includes/file.php');
                  include_once(ABSPATH . 'wp-admin/includes/misc.php');
                  include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');

                  // Install the plugin
                  $medical_landing_page_upgrader = new Plugin_Upgrader();
                  $medical_landing_page_upgrader->install('https://downloads.wordpress.org/plugin/ibtana-visual-editor.latest-stable.zip');
              }
              // Activate the plugin
              activate_plugin($medical_landing_page_plugin_file);
            }


            // ------- Create Nav Menu --------
            $ecommerce_landing_page_menuname = 'Main Menus';
            $ecommerce_landing_page_bpmenulocation = 'primary';
            $ecommerce_landing_page_menu_exists = wp_get_nav_menu_object($ecommerce_landing_page_menuname);

            if (!$ecommerce_landing_page_menu_exists) {
                $ecommerce_landing_page_menu_id = wp_create_nav_menu($ecommerce_landing_page_menuname);

                // Create Home Page
                $ecommerce_landing_page_home_title = 'Home';
                $ecommerce_landing_page_home = array(
                    'post_type' => 'page',
                    'post_title' => $ecommerce_landing_page_home_title,
                    'post_content' => '',
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'home'
                );
                $ecommerce_landing_page_home_id = wp_insert_post($ecommerce_landing_page_home);
                // Assign Home Page Template
                add_post_meta($ecommerce_landing_page_home_id, '_wp_page_template', 'page-template/custom-home-page.php');
                // Update options to set Home Page as the front page
                update_option('page_on_front', $ecommerce_landing_page_home_id);
                update_option('show_on_front', 'page');
                // Add Home Page to Menu
                wp_update_nav_menu_item($ecommerce_landing_page_menu_id, 0, array(
                    'menu-item-title' => __('Home', 'ecommerce-landing-page'),
                    'menu-item-classes' => 'home',
                    'menu-item-url' => home_url('/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $ecommerce_landing_page_home_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create Pages Page with Dummy Content
                $ecommerce_landing_page_pages_title = 'Pages';
                $ecommerce_landing_page_pages_content = 'Explore all the pages we have on our website. Find information about our services, company, and more.
                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br>
                All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.';
                $ecommerce_landing_page_pages = array(
                    'post_type' => 'page',
                    'post_title' => $ecommerce_landing_page_pages_title,
                    'post_content' => $ecommerce_landing_page_pages_content,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'pages'
                );
                $ecommerce_landing_page_pages_id = wp_insert_post($ecommerce_landing_page_pages);
                // Add Pages Page to Menu
                wp_update_nav_menu_item($ecommerce_landing_page_menu_id, 0, array(
                    'menu-item-title' => __('Pages', 'ecommerce-landing-page'),
                    'menu-item-classes' => 'pages',
                    'menu-item-url' => home_url('/pages/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $ecommerce_landing_page_pages_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));

                // Create About Us Page with Dummy Content
                $ecommerce_landing_page_about_title = 'About Us';
                $ecommerce_landing_page_about_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam...<br>
                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br>
                There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text.<br>
                 All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.';
                $ecommerce_landing_page_about = array(
                    'post_type' => 'page',
                    'post_title' => $ecommerce_landing_page_about_title,
                    'post_content' => $ecommerce_landing_page_about_content,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    'post_slug' => 'about-us'
                );
                $ecommerce_landing_page_about_id = wp_insert_post($ecommerce_landing_page_about);
                // Add About Us Page to Menu
                wp_update_nav_menu_item($ecommerce_landing_page_menu_id, 0, array(
                    'menu-item-title' => __('About Us', 'ecommerce-landing-page'),
                    'menu-item-classes' => 'about-us',
                    'menu-item-url' => home_url('/about-us/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $ecommerce_landing_page_about_id,
                    'menu-item-object' => 'page',
                    'menu-item-type' => 'post_type'
                ));
                
                 /*  Create Services Page */
                $ecommerce_landing_page_services_title = 'Services';
                $ecommerce_landing_page_services_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br>
                We offer a wide range of ecommerce services including product management, order fulfillment, payment integration, and customer support solutions.<br>
                Our services are designed to help businesses grow faster, sell smarter, and deliver better customer experiences.';

                $ecommerce_landing_page_services = array(
                    'post_type'    => 'page',
                    'post_title'   => $ecommerce_landing_page_services_title,
                    'post_content' => $ecommerce_landing_page_services_content,
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_slug'    => 'services'
                );
                $ecommerce_landing_page_services_id = wp_insert_post($ecommerce_landing_page_services);

                wp_update_nav_menu_item($ecommerce_landing_page_menu_id, 0, array(
                    'menu-item-title'  => __('Services', 'ecommerce-landing-page'),
                    'menu-item-classes'=> 'services',
                    'menu-item-url'    => home_url('/services/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $ecommerce_landing_page_services_id,
                    'menu-item-object' => 'page',
                    'menu-item-type'   => 'post_type'
                ));

                /*  Create Experts Page  */
                $ecommerce_landing_page_experts_title = 'Experts';
                $ecommerce_landing_page_experts_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br>
                Our expert team consists of ecommerce strategists, developers, designers, and digital marketers with years of industry experience.<br>
                We work collaboratively to deliver innovative solutions and measurable business results.';

                $ecommerce_landing_page_experts = array(
                    'post_type'    => 'page',
                    'post_title'   => $ecommerce_landing_page_experts_title,
                    'post_content' => $ecommerce_landing_page_experts_content,
                    'post_status'  => 'publish',
                    'post_author'  => 1,
                    'post_slug'    => 'experts'
                );
                $ecommerce_landing_page_experts_id = wp_insert_post($ecommerce_landing_page_experts);

                wp_update_nav_menu_item($ecommerce_landing_page_menu_id, 0, array(
                    'menu-item-title'  => __('Experts', 'ecommerce-landing-page'),
                    'menu-item-classes'=> 'experts',
                    'menu-item-url'    => home_url('/experts/'),
                    'menu-item-status' => 'publish',
                    'menu-item-object-id' => $ecommerce_landing_page_experts_id,
                    'menu-item-object' => 'page',
                    'menu-item-type'   => 'post_type'
                ));

                // Create Blog Page 
                $ecommerce_landing_page_blog_page_title = 'Blog';
                $ecommerce_landing_page_blog_page_query = new WP_Query(array(
                    'post_type'      => 'page',
                    'name'           => sanitize_title($ecommerce_landing_page_blog_page_title),
                    'post_status'    => 'publish',
                    'posts_per_page' => 1
                ));
                if (!$ecommerce_landing_page_blog_page_query->have_posts()) {
                    $ecommerce_landing_page_blog_page = array(
                    'post_type'   => 'page',
                    'post_title'  => $ecommerce_landing_page_blog_page_title,
                    'post_status' => 'publish',
                    'post_author' => 1,
                    );
                    $ecommerce_landing_page_blog_page_id = wp_insert_post($ecommerce_landing_page_blog_page);
                    update_option('page_for_posts', $ecommerce_landing_page_blog_page_id);
                    wp_update_nav_menu_item($ecommerce_landing_page_menu_id, 0, array(
                    'menu-item-title'      => __('Blog', 'ecommerce-landing-page'),
                    'menu-item-url'        => get_permalink($ecommerce_landing_page_blog_page_id),
                    'menu-item-status'     => 'publish',
                    'menu-item-object-id'  => $ecommerce_landing_page_blog_page_id,
                    'menu-item-object'     => 'page',
                    'menu-item-type'       => 'post_type',
                    ));
                }

                // Set the menu location if it's not already set
                if (!has_nav_menu($ecommerce_landing_page_bpmenulocation)) {
                    $locations = get_theme_mod('nav_menu_locations'); // Use 'nav_menu_locations' to get locations array
                    if (empty($locations)) {
                        $locations = array();
                    }
                    $locations[$ecommerce_landing_page_bpmenulocation] = $ecommerce_landing_page_menu_id;
                    set_theme_mod('nav_menu_locations', $locations);
                }

        }


            // Set the demo import completion flag
    		update_option('ecommerce_landing_page_demo_import_completed', true);
    		// Display success message and "View Site" button
    		echo '<p class="notice-text">' . esc_html__('Your demo import has been completed successfully.', 'ecommerce-landing-page') . '</p>';
    		echo '<span><a href="' . esc_url(home_url()) . '" class="button button-primary site-btn" target="_blank">' . esc_html__('View Site', 'ecommerce-landing-page') . '</a></span>';
            echo '<span><a href="'. esc_url(admin_url('customize.php') ) .'" class="button button-primary demo-btn" target=_blank>'. esc_html__( 'Customize Your Site', 'medical-landing-page' ) .'</a></span>';
            echo '<span><a href="'. esc_url( 'https://preview.vwthemesdemo.com/docs/free-medical-landing-page/' ) .'" class="button button-primary doc-btn" target=_blank>'. esc_html__( 'Free Theme Documentation', 'medical-landing-page' ) .'</a></span>';
            //end


            // Top Bar //
            set_theme_mod('ecommerce_landing_page_topbar_myaccount_icon', 'fas fa-user' );
            set_theme_mod('ecommerce_landing_page_top_myaccount_icon_url', '#' );

            // slider section start //
            set_theme_mod( 'ecommerce_landing_page_tagline_title', 'Get Ready For Your Best Ever Denatal Experience' );
            set_theme_mod( 'ecommerce_landing_page_designation_text', 'Lorem ipsum is simply dummy text of the printing and typesetting industry. ipsum is simply dummy text of the printing and typesetting industry.' );
            set_theme_mod( 'ecommerce_landing_page_banner_button_label', 'Book Now' );           
            set_theme_mod( 'ecommerce_landing_page_top_button_url', '#' );

            set_theme_mod( 'medical_landing_page_video_button_icon', 'fas fa-play' );
            set_theme_mod( 'medical_landing_page_video_button_text', 'See How We Work' );
            set_theme_mod( 'medical_landing_page_video_button_url', 'https://www.youtube.com/watch?v=9xwazD5SyVg' );
            set_theme_mod( 'medical_landing_page_banner_bg_image', get_theme_file_uri().'/assets/images/banner.png');
            set_theme_mod( 'medical_landing_page_banner_image', get_theme_file_uri().'/assets/images/nurse.png');
            set_theme_mod( 'medical_landing_page_phone_icon', 'fas fa-phone' );
            set_theme_mod( 'medical_landing_page_phone_text', '24 Hrs Emergency' );
            set_theme_mod( 'medical_landing_page_activecientcount_icon', 'fas fa-users' );
            set_theme_mod( 'medical_landing_page_phone_number', '1234567890' );
            set_theme_mod( 'medical_landing_page_review_text', '1.5K Patients LOve it.' );
            set_theme_mod( 'medical_landing_page_about_icon', 'fas fa-user-md' );
            set_theme_mod( 'medical_landing_page_about_title', '24 Hrs Doctor' );
            set_theme_mod( 'medical_landing_page_about_text', 'We Provide The Best Medical Services' );

            // About Section //
            set_theme_mod( 'medical_landing_page_rating_icon', 'fas fa-users' );
            set_theme_mod( 'medical_landing_page_rating_count', '93' );
            set_theme_mod( 'medical_landing_page_rating_text', 'Satisfaction Rate' );           
            set_theme_mod( 'medical_landing_page_expert_doctor_icon', 'fas fa-user-md' );
            set_theme_mod( 'medical_landing_page_expert_doctor_count', '21' );
            set_theme_mod( 'medical_landing_page_expert_doctor_text', 'Experts Doctors' );

            // Health Solution Section //
            set_theme_mod( 'medical_landing_page_health_image1', get_theme_file_uri().'/assets/images/solution1.png');
            set_theme_mod( 'medical_landing_page_health_image2', get_theme_file_uri().'/assets/images/solution2.png');

            set_theme_mod( 'medical_landing_page_health_title', 'All In One Treatment And Health Solution' );
            set_theme_mod( 'medical_landing_page_health_text1', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard' );
            set_theme_mod( 'medical_landing_page_health_text2', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard' );
            set_theme_mod( 'medical_landing_page_team_icon', 'fas fa-users');
            set_theme_mod( 'medical_landing_page_team_title', 'Dedicated Team');
            set_theme_mod( 'medical_landing_page_team_text', 'Lorem Ipsum is simply dummy text of the printing and' );
            set_theme_mod( 'medical_landing_page_hospital_icon', 'fas fa-hospital' );
            set_theme_mod( 'medical_landing_page_hospital_title', 'Medical & Health' );
            set_theme_mod( 'medical_landing_page_hospital_text', 'Lorem Ipsum is simply dummy text of the printing and' );
            set_theme_mod( 'medical_landing_page_environment_icon', 'fa-solid fa-hand-holding-medical' );
            set_theme_mod( 'medical_landing_page_environment_title', 'Friendly Environment' );
            set_theme_mod( 'medical_landing_page_environment_text', 'Lorem Ipsum is simply dummy text of the printing and' );


            // Latest News And Blog Section
            set_theme_mod('ecommerce_landing_page_latest_news_blog_heading', 'Latest News & Blogs' );
            set_theme_mod('ecommerce_landing_page_latest_news_blog_small_title', 'Lorem ipsum is simply dummy text' );
            set_theme_mod('ecommerce_landing_page_latest_post_author_icon', 'fas fa-user' );
            set_theme_mod('ecommerce_landing_page_latest_post_comments_icon', 'fas fa-comment' );
            set_theme_mod('ecommerce_landing_page_events_category', 'wiredheadphones' );
            
                // Define post category names and post titles
                $ecommerce_landing_page_category_names = array('wiredheadphones', 'postcategory2', 'postcategory3');
                $ecommerce_landing_page_title_array = array(
                    array("Lorem ipsum is simply dummy text of the printing and typesetting industry ", "Lorem ipsum is simply dummy text of the printing and typesetting industry", "Lorem ipsum is simply dummy text of the printing and typesetting industry"),
                    array("Wireless Headphones", "Wireless Headphones", "Wireless Headphones"),
                    array("Wireless Headphones", "Wireless Headphones", "Wireless Headphones")
                );
    
                foreach ($ecommerce_landing_page_category_names as $ecommerce_landing_page_index => $ecommerce_landing_page_category_name) {
                    // Create or retrieve the post category term ID
                    $ecommerce_landing_page_term = term_exists($ecommerce_landing_page_category_name, 'category');
                    if ($ecommerce_landing_page_term === 0 || $ecommerce_landing_page_term === null) {
                        // If the term does not exist, create it
                        $ecommerce_landing_page_term = wp_insert_term($ecommerce_landing_page_category_name, 'category');
                    }
                    if (is_wp_error($ecommerce_landing_page_term)) {
                        error_log('Error creating category: ' . $ecommerce_landing_page_term->get_error_message());
                        continue; // Skip to the next iteration if category creation fails
                    }
    
                    for ($ecommerce_landing_page_i = 0; $ecommerce_landing_page_i < 3; $ecommerce_landing_page_i++) {
                        // Create post content
                        $ecommerce_landing_page_title = $ecommerce_landing_page_title_array[$ecommerce_landing_page_index][$ecommerce_landing_page_i];
    
                        // Create post post object
                        $ecommerce_landing_page_my_post = array(
                            'post_title'    => wp_strip_all_tags($ecommerce_landing_page_title),
                            'post_status'   => 'publish',
                            'post_type'     => 'post', // Post type set to 'post'
                        );
    
                        // Insert the post into the database
                        $ecommerce_landing_page_post_id = wp_insert_post($ecommerce_landing_page_my_post);
    
                        update_post_meta($ecommerce_landing_page_post_id, 'ecommerce_landing_page_date', "25 Jan");
    
                        if (is_wp_error($ecommerce_landing_page_post_id)) {
                            error_log('Error creating post: ' . $ecommerce_landing_page_post_id->get_error_message());
                            continue; // Skip to the next post if creation fails
                        }
    
                        // Assign the category to the post
                        wp_set_post_categories($ecommerce_landing_page_post_id, array((int)$ecommerce_landing_page_term['term_id']));
    
                        // Handle the featured image using media_sideload_image
                        $ecommerce_landing_page_image_url = get_theme_file_uri() . '/assets/images/blog' . ($ecommerce_landing_page_i + 1) . '.png';
                        $ecommerce_landing_page_image_id = media_sideload_image($ecommerce_landing_page_image_url, $ecommerce_landing_page_post_id, null, 'id');
    
                        if (is_wp_error($ecommerce_landing_page_image_id)) {
                            error_log('Error downloading image: ' . $ecommerce_landing_page_image_id->get_error_message());
                            continue; // Skip to the next post if image download fails
                        }
                        // Assign featured image to post
                        set_post_thumbnail($ecommerce_landing_page_post_id, $ecommerce_landing_page_image_id);
                    }
                } 

            // Latest News And Blog Section
            set_theme_mod('medical_landing_page_feature_courses_tagline_title1', 'Our Service' );
            set_theme_mod('medical_landing_page_feature_courses_tagline_title', 'We Serve the Best Work' );
            set_theme_mod('ecommerce_landing_page_feature_category', 'postcategory1' );
            
                // Define post category names and post titles
                $medical_landing_page_category_names = array('postcategory1', 'postcategory2');
                $medical_landing_page_title_array = array(
                    array("Custom Software Development", "Web Development and Design", "Data Analytics and Business Intelligence"),
                    array("Custom Software Development", "Web Development and Design", "Data Analytics and Business Intelligence")
                );
    
                foreach ($medical_landing_page_category_names as $medical_landing_page_index => $medical_landing_page_category_name) {
                    // Create or retrieve the post category term ID
                    $medical_landing_page_term = term_exists($medical_landing_page_category_name, 'category');
                    if ($medical_landing_page_term === 0 || $medical_landing_page_term === null) {
                        // If the term does not exist, create it
                        $medical_landing_page_term = wp_insert_term($medical_landing_page_category_name, 'category');
                    }
                    if (is_wp_error($medical_landing_page_term)) {
                        error_log('Error creating category: ' . $medical_landing_page_term->get_error_message());
                        continue; // Skip to the next iteration if category creation fails
                    }
    
                    for ($medical_landing_page_i = 0; $medical_landing_page_i < 3; $medical_landing_page_i++) {
                        // Create post content
                        $medical_landing_page_title = $medical_landing_page_title_array[$medical_landing_page_index][$medical_landing_page_i];
                        $medical_landing_page_content = 'Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.';
    
                        // Create post post object
                        $medical_landing_page_my_post = array(
                            'post_title'    => wp_strip_all_tags($medical_landing_page_title),
                            'post_content'  => $medical_landing_page_content,
                            'post_status'   => 'publish',
                            'post_type'     => 'post', // Post type set to 'post'
                        );
    
                        // Insert the post into the database
                        $medical_landing_page_post_id = wp_insert_post($medical_landing_page_my_post);
    
                        if (is_wp_error($medical_landing_page_post_id)) {
                            error_log('Error creating post: ' . $medical_landing_page_post_id->get_error_message());
                            continue; // Skip to the next post if creation fails
                        }
    
                        // Assign the category to the post
                        wp_set_post_categories($medical_landing_page_post_id, array((int)$medical_landing_page_term['term_id']));
    
                        // Handle the featured image using media_sideload_image
                        $medical_landing_page_image_url = get_theme_file_uri() . '/assets/images/post' . ($medical_landing_page_i + 1) . '.png';
                        $medical_landing_page_image_id = media_sideload_image($medical_landing_page_image_url, $medical_landing_page_post_id, null, 'id');
    
                        if (is_wp_error($medical_landing_page_image_id)) {
                            error_log('Error downloading image: ' . $medical_landing_page_image_id->get_error_message());
                            continue; // Skip to the next post if image download fails
                        }
                        // Assign featured image to post
                        set_post_thumbnail($medical_landing_page_post_id, $medical_landing_page_image_id);
                    }
                } 
                    
                //Copyright Text
                set_theme_mod( 'ecommerce_landing_page_footer_text', 'By VWThemes' );
        }
    ?>

    <form action="<?php echo esc_url(home_url()); ?>/wp-admin/themes.php?page=medical_landing_page_guide" method="POST" onsubmit="return validate(this);">
        <?php if (!get_option('ecommerce_landing_page_demo_import_completed')) : ?>
             <form method="post">   
            <p class="run-import-text"><?php esc_html_e('Click On The Below Run Importer Button To Import Demo Content Of medical landing page', 'medical-landing-page'); ?></p>
                <p><?php esc_html_e('Please back up your website if it’s already live with data. This importer will overwrite your existing settings with the new customizer values for medical landing page', 'medical-landing-page'); ?></p>
                <input class="run-import" type="submit" name="submit" value="<?php esc_attr_e('Run Importer', 'medical-landing-page'); ?>" class="button button-primary button-large">
          </form>
        <?php endif; ?>
        <div id="spinner" style="display:none;">         
            <img src="<?php echo esc_url(get_theme_file_uri()); ?>/assets/images/spinner.png" alt="" />
        </div>
    </form>
    <script type="text/javascript">
        function validate(form) {
            if (confirm("Do you really want to import the theme demo content?")) {
                // Show the spinner
                document.getElementById('spinner').style.display = 'block';
                // Allow the form to be submitted
                return true;
            } 
            else {
                return false;
            }
        }
    </script>
</div>
