<?php
/**
 * @package Demo Import
 * @since 1.0.0
 */

class ThemeWhizzie {

	protected $version = '1.1.0';

	/** @var string Current theme name, used as namespace in actions. */
	protected $theme_name = '';
	protected $theme_title = '';

	/** @var string Demo Import page slug and title. */
	protected $page_slug = '';
	protected $page_title = '';

	/** @var array Demo Import steps set by user. */
	protected $config_steps = array();
	public $parent_slug;
	/**
	 * Constructor
	 *
	 * @param $automotive_parts_config	Our config parameters
	*/
	public function __construct( $automotive_parts_config ) {
		$this->set_vars( $automotive_parts_config );
		$this->init();
	}

	/**
	 * Set some settings
	 * @since 1.0.0
	 * @param $automotive_parts_config	Our config parameters
	*/
	public function set_vars( $automotive_parts_config ) {
		if( isset( $automotive_parts_config['page_slug'] ) ) {
			$this->page_slug = esc_attr( $automotive_parts_config['page_slug'] );
		}
		if( isset( $automotive_parts_config['page_title'] ) ) {
			$this->page_title = esc_attr( $automotive_parts_config['page_title'] );
		}
		if( isset( $automotive_parts_config['steps'] ) ) {
			$this->config_steps = $automotive_parts_config['steps'];
		}

		$current_theme = wp_get_theme();
		$this->theme_title = $current_theme->get( 'Name' );
		$this->theme_name = strtolower( preg_replace( '#[^a-zA-Z]#', '', $current_theme->get( 'Name' ) ) );
		$this->page_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_page_slug', $this->theme_name . '-demoimport' );
		$this->parent_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_parent_slug', '' );
	}

	/**
	 * Hooks and filters
	 * @since 1.0.0
	*/
	public function init() {
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
		add_action( 'admin_menu', array( $this, 'menu_page' ) );
		add_action( 'wp_ajax_setup_widgets', array( $this, 'setup_widgets' ) );
	}
	
	public function enqueue_scripts() {
		wp_enqueue_style( 'demo-import-style', get_template_directory_uri() . '/demo-import/assets/css/demo-import-style.css');
		wp_register_script( 'demo-import-script', get_template_directory_uri() . '/demo-import/assets/js/demo-import-script.js', array( 'jquery' ), time() );
		wp_localize_script(
			'demo-import-script',
			'automotive_parts_whizzie_params',
			array(
				'ajaxurl' 		=> admin_url( 'admin-ajax.php' ),
				'wpnonce' 		=> wp_create_nonce( 'whizzie_nonce' ),
				'verify_text'	=> esc_html( 'verifying', 'automotive-parts' )
			)
		);
		wp_enqueue_script( 'demo-import-script' );
	}

	/**  Make a modal screen for the wizard **/
	public function menu_page() {
		add_menu_page( esc_html( $this->page_title ), esc_html( $this->page_title ), 'manage_options', $this->page_slug, array( $this, 'automotive_parts_guide' ) ,'',40);
	}

	/** Make an interface for the wizard **/
	public function wizard_page() {
		/* If we arrive here, we have the filesystem */ ?>
		<div class="wrap">
			<?php echo '<div class="whizzie-wrap">';
				// The wizard is a list with only one item visible at a time
				$steps = $this->get_steps();
				echo '<ul class="whizzie-nav wizard-icon-nav">';?>
				<?php
					$stepI=1;
					foreach( $steps as $step ) {
						$stepAct=($stepI ==1)? 1 : 0;
						if( isset( $step['icon_text'] ) && $step['icon_text'] ) {
							echo '<li class="commom-cls nav-step-' . esc_attr( $step['id'] ) . '" wizard-steps="step-'.esc_attr( $step['id'] ).'" data-enable="'.$stepAct.'">
							<p>'.esc_attr( $step['icon_text'] ).'</p>
							</li>';
						}
					$stepI++;}
			 	echo '</ul>';
				echo '<ul class="whizzie-menu wizard-menu-page">';
				foreach( $steps as $step ) {
					$class = 'step step-' . esc_attr( $step['id'] );
					echo '<li data-step="' . esc_attr( $step['id'] ) . '" class="' . esc_attr( $class ) . '" >';
						$content = call_user_func( array( $this, $step['view'] ) );
						printf('<div class="wizard-button-wrapper">');
							if( isset( $step['button_text_one'] )) {
								printf(
									'<div class="button-wrap button-wrap-one">
										<a href="#" class="button button-primary do-it" data-callback="install_widgets" data-step="widgets"><p class="demo-type-text">%s</p></a>
									</div>',
									esc_html( $step['button_text_one'] )
								);
							}
						printf('</div>');
					echo '</li>';
				}
				echo '</ul>';
				?>
				<div class="step-loading"><span class="spinner">
					<img src="<?php echo esc_url(get_template_directory_uri().'/demo-import/assets/images/Spinner-Animaion.gif'); ?>">
				</span></div>
			<?php echo '</div>';?>
		</div>
	<?php }

	/**
	 * Set options for the steps
	 * @return Array
	*/
	public function get_steps() {
		if ( get_option('automotive_parts_demo_imported') ) {
			return array(
				'done' => array(
					'id'        => 'done',
					'title'     => __( 'All Done', 'automotive-parts' ),
					'icon'      => 'yes',
					'view'      => 'get_step_done',
					'callback'  => '',
					'icon_text' => 'View Site'
				)
			);
		}
		$dev_steps = $this->config_steps;
		$steps = array(
			'widgets' => array(
				'id'			=> 'widgets',
				'title'			=> __( 'Customizer', 'automotive-parts' ),
				'icon'			=> 'welcome-widgets-menus',
				'view'			=> 'get_step_widgets',
				'callback'		=> 'install_widgets',
				'button_text_one'	=> __( 'Import Demo', 'automotive-parts' ),
				'can_skip'		=> true,
				'icon_text'      => 'Import Demo'
			),
			'done' => array(
				'id'			=> 'done',
				'title'			=> __( 'All Done', 'automotive-parts' ),
				'icon'			=> 'yes',
				'view'			=> 'get_step_done',
				'callback'		=> '',
				'icon_text'      => 'Done'
			)
		);
		// Iterate through each step and replace with dev config values
		if( $dev_steps ) {
			// Configurable elements - these are the only ones the dev can update from config.php
			$can_config = array( 'title', 'icon', 'button_text', 'can_skip' );
			foreach( $dev_steps as $dev_step ) {
				// We can only proceed if an ID exists and matches one of our IDs
				if( isset( $dev_step['id'] ) ) {
					$id = $dev_step['id'];
					if( isset( $steps[$id] ) ) {
						foreach( $can_config as $element ) {
							if( isset( $dev_step[$element] ) ) {
								$steps[$id][$element] = $dev_step[$element];
							}
						}
					}
				}
			}
		}
		return $steps;
	}

	/**    Print the content for the intro step     **/
		public function get_step_importer() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('Thank you for choosing this Automotive Parts Theme. Using this quick setup wizard, you will be able to configure your new website and get it running in just a few minutes. Just follow these simple steps mentioned in the wizard and get started with your website.','automotive-parts'); ?>
			</p>
		</div>
	<?php }

	/**   Print the content for the widgets step   **/
	public function get_step_widgets() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('This theme allows you to import demo content and add widgets. Install them using the button below. You can also update or deactivate them using the Customizer.','automotive-parts'); ?>
			</p>
		</div>
	<?php }

	/** Print the content for the final step **/
	public function get_step_done() { ?>

		<div class="setup-finish">
			<p>
				<?php echo esc_html('Your demo content has been imported successfully. Click the finish button for more information.'); ?>
			</p>
			<div class="finish-buttons">
				<a href="<?php echo esc_url( admin_url( 'themes.php?page=automotive-parts-getstart-page' ) ); ?>" class="wz-btn-customizer" target="_blank"><?php esc_html_e('About Automotive Parts','automotive-parts') ?></a>
				<a href="<?php echo esc_url(admin_url('/customize.php')); ?>" class="wz-btn-customizer" target="_blank"><?php esc_html_e('Customize Your Demo','automotive-parts') ?></a>
				<a href="<?php echo esc_url(home_url()); ?>" class="wz-btn-visit-site" target="_blank"><?php esc_html_e('Visit Your Site','automotive-parts'); ?></a>
			</div>
			<div class="finish-buttons">
				<a href="<?php echo esc_url(admin_url()); ?>" class="button button-primary"><?php esc_html_e('Finish','automotive-parts'); ?></a>
			</div>
		</div>

	<?php }


	public function automotive_parts_customizer_nav_menu() {
		// ------- Create Primary Menu --------
		$automotive_parts_themename = 'Automotive Parts'; // Ensure the theme name is set
		$automotive_parts_menuname = $automotive_parts_themename . ' Primary Menu';
		$automotive_parts_menulocation = 'menu-1';
		$automotive_parts_menu_exists = wp_get_nav_menu_object($automotive_parts_menuname);

		if (!$automotive_parts_menu_exists) {
			$automotive_parts_menu_id = wp_create_nav_menu($automotive_parts_menuname);

			// Home
			wp_update_nav_menu_item($automotive_parts_menu_id, 0, array(
				'menu-item-title' => __('Home', 'automotive-parts'),
				'menu-item-classes' => 'home',
				'menu-item-url' => home_url('/'),
				'menu-item-status' => 'publish'
			));

			// About
			$automotive_parts_page_about = get_page_by_path('about');
			if($automotive_parts_page_about){
				wp_update_nav_menu_item($automotive_parts_menu_id, 0, array(
					'menu-item-title' => __('About', 'automotive-parts'),
					'menu-item-classes' => 'about',
					'menu-item-url' => get_permalink($automotive_parts_page_about),
					'menu-item-status' => 'publish'
				));
			}

			// Services
			$automotive_parts_page_services = get_page_by_path('services');
			if($automotive_parts_page_services){
				wp_update_nav_menu_item($automotive_parts_menu_id, 0, array(
					'menu-item-title' => __('Services', 'automotive-parts'),
					'menu-item-classes' => 'services',
					'menu-item-url' => get_permalink($automotive_parts_page_services),
					'menu-item-status' => 'publish'
				));
			}

			// Blog
			$automotive_parts_page_blog = get_page_by_path('blog');
			if($automotive_parts_page_blog){
				wp_update_nav_menu_item($automotive_parts_menu_id, 0, array(
					'menu-item-title' => __('Blog', 'automotive-parts'),
					'menu-item-classes' => 'blog',
					'menu-item-url' => get_permalink($automotive_parts_page_blog),
					'menu-item-status' => 'publish'
				));
			}

			// Contact Us
			$automotive_parts_page_contact = get_page_by_path('contact');
			if($automotive_parts_page_contact){
				wp_update_nav_menu_item($automotive_parts_menu_id, 0, array(
					'menu-item-title' => __('Contact Us', 'automotive-parts'),
					'menu-item-classes' => 'contact',
					'menu-item-url' => get_permalink($automotive_parts_page_contact),
					'menu-item-status' => 'publish'
				));
			}

			// Assign menu to location if not set
			if (!has_nav_menu($automotive_parts_menulocation)) {
				$automotive_parts_locations = get_theme_mod('nav_menu_locations');
				$automotive_parts_locations[$automotive_parts_menulocation] = $automotive_parts_menu_id; // Use $automotive_parts_menu_id here
				set_theme_mod('nav_menu_locations', $automotive_parts_locations);
			}
		}
	}

	public function automotive_parts_social_menu() {

		// ------- Create Social Menu --------
		$automotive_parts_menuname = $automotive_parts_themename . 'Social Menu';
		$automotive_parts_menulocation = 'social-menu';
		$automotive_parts_menu_exists = wp_get_nav_menu_object( $automotive_parts_menuname );

		if( !$automotive_parts_menu_exists){
			$automotive_parts_menu_id = wp_create_nav_menu($automotive_parts_menuname);

			wp_update_nav_menu_item( $automotive_parts_menu_id, 0, array(
				'menu-item-title'  => __( 'Facebook', 'automotive-parts' ),
				'menu-item-url'    => 'https://www.facebook.com',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $automotive_parts_menu_id, 0, array(
				'menu-item-title'  => __( 'Pinterest', 'automotive-parts' ),
				'menu-item-url'    => 'https://www.pinterest.com',
				'menu-item-status' => 'publish',
			) );
	
			wp_update_nav_menu_item( $automotive_parts_menu_id, 0, array(
				'menu-item-title'  => __( 'Twitter', 'automotive-parts' ),
				'menu-item-url'    => 'https://www.twitter.com',
				'menu-item-status' => 'publish',
			) );
	
			wp_update_nav_menu_item( $automotive_parts_menu_id, 0, array(
				'menu-item-title'  => __( 'Youtube', 'automotive-parts' ),
				'menu-item-url'    => 'https://www.youtube.com',
				'menu-item-status' => 'publish',
			) );

			wp_update_nav_menu_item( $automotive_parts_menu_id, 0, array(
				'menu-item-title'  => __( 'Instagram', 'automotive-parts' ),
				'menu-item-url'    => 'https://www.instagram.com',
				'menu-item-status' => 'publish',
			) );

			if( !has_nav_menu( $automotive_parts_menulocation ) ){
					$locations = get_theme_mod('nav_menu_locations');
					$locations[$automotive_parts_menulocation] = $automotive_parts_menu_id;
					set_theme_mod( 'nav_menu_locations', $locations );
			}
		}
	}

	/**
	* Imports the Demo Content
	* @since 1.1.0
	*/
	public function setup_widgets() {

		//................................................. MENU PAGES .................................................//
		
		$automotive_parts_home_id='';
		$automotive_parts_home_content = '';

		$automotive_parts_home_title = 'Home';
		$automotive_parts_home = array(
				'post_type' => 'page',
				'post_title' => $automotive_parts_home_title,
				'post_content'  => $automotive_parts_home_content,
				'post_status' => 'publish',
				'post_author' => 1,
				'post_slug' => 'home'
		);
		$automotive_parts_home_id = wp_insert_post($automotive_parts_home);

		//Set the home page template
		add_post_meta( $automotive_parts_home_id, '_wp_page_template', 'revolution-home.php' );

		//Set the static front page
		$automotive_parts_home = get_page_by_title( 'Home' );
		update_option( 'page_on_front', $automotive_parts_home->ID );
		update_option( 'show_on_front', 'page' );


		// Create a posts page and assign the template
		$automotive_parts_blog_title = 'Blog';
		$automotive_parts_blog_check = get_page_by_path('blog');
		if (!$automotive_parts_blog_check) {
			$automotive_parts_blog = array(
				'post_type'    => 'page',
				'post_title'   => $automotive_parts_blog_title,
				'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'blog' // Unique slug for the blog page
			);
			$automotive_parts_blog_id = wp_insert_post($automotive_parts_blog);

			// Set the posts page
			if (!is_wp_error($automotive_parts_blog_id)) {
				update_option('page_for_posts', $automotive_parts_blog_id);
			}
		}

		// Create a Contact Us page and assign the template
		$automotive_parts_contact_title = 'Contact Us';
		$automotive_parts_contact_check = get_page_by_path('contact');
		if (!$automotive_parts_contact_check) {
			$automotive_parts_contact = array(
				'post_type'    => 'page',
				'post_title'   => $automotive_parts_contact_title,
				'post_content'   => '"More About The Free Automotive Parts WordPress Theme"
										This theme blends a sophisticated layout with automotive grit. Its clean interface features bold image sections, customizable banners, and crisp typography that highlights every product and service. Personalization is simple with multiple layout options, color pickers, and widgetized areas. You can tailor the homepage to feature car categories like car lights, transmission parts, or performance upgrades, while the inner pages allow showcasing of detailed inventory. Visual appeal meets practicality, offering responsive design that looks great on all devices and ensures a smooth browsing experience.

										The Automotive Parts WordPress Theme isn’t just about looks—it’s a powerful and comprehensive digital solution designed specifically for modern automotive businesses. Whether you specialize in aftermarket upgrades, OEM parts, truck accessories, car lights, or air conditioning parts, this theme allows you to professionally organize your entire inventory into clean, accessible categories. From the homepage to the checkout page, the user journey is seamless and intuitive, encouraging conversions. Showcase your products like brake pads, engine mounts, tire inflators, or spark plugs using the built-in image gallery, enhancing visibility and customer engagement. You can also highlight your company’s story, values, service guarantees, and team on dedicated inner pages, adding credibility and trust. With customization options to reflect your brand’s unique identity, this theme empowers you to create a tailored, user-focused shopping experience that supports both growth and customer satisfaction.

										The Automotive Parts WordPress Theme is ideal for both new startups and well-established automotive businesses looking to enhance their digital presence. With seamless WooCommerce integration, you can effortlessly set up an online store and begin selling performance parts, racing accessories, or eco-friendly car parts right away. Whether your inventory includes fuel injectors, clutch kits, or brake rotors, the theme offers smooth product categorization and checkout flow. Use the “Meet the Team” section to introduce your experts, while offering detailed installation guides to build trust and reduce support queries. A built-in testimonial section boosts your brand’s credibility by showcasing positive customer feedback. Additionally, the theme includes a customizable blog area where you can share updates on new arrivals, maintenance tips, or automotive trends—perfect for engaging visitors and improving your SEO rankings.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'contact' // Unique slug for the Contact Us page
			);
			wp_insert_post($automotive_parts_contact);
		}

		// Create a About page and assign the template
		$automotive_parts_about_title = 'About';
		$automotive_parts_about_check = get_page_by_path('about');
		if (!$automotive_parts_about_check) {
			$automotive_parts_about = array(
				'post_type'    => 'page',
				'post_title'   => $automotive_parts_about_title,
				'post_content'   => '"More About The Free Automotive Parts WordPress Theme"
										This theme blends a sophisticated layout with automotive grit. Its clean interface features bold image sections, customizable banners, and crisp typography that highlights every product and service. Personalization is simple with multiple layout options, color pickers, and widgetized areas. You can tailor the homepage to feature car categories like car lights, transmission parts, or performance upgrades, while the inner pages allow showcasing of detailed inventory. Visual appeal meets practicality, offering responsive design that looks great on all devices and ensures a smooth browsing experience.

										The Automotive Parts WordPress Theme isn’t just about looks—it’s a powerful and comprehensive digital solution designed specifically for modern automotive businesses. Whether you specialize in aftermarket upgrades, OEM parts, truck accessories, car lights, or air conditioning parts, this theme allows you to professionally organize your entire inventory into clean, accessible categories. From the homepage to the checkout page, the user journey is seamless and intuitive, encouraging conversions. Showcase your products like brake pads, engine mounts, tire inflators, or spark plugs using the built-in image gallery, enhancing visibility and customer engagement. You can also highlight your company’s story, values, service guarantees, and team on dedicated inner pages, adding credibility and trust. With customization options to reflect your brand’s unique identity, this theme empowers you to create a tailored, user-focused shopping experience that supports both growth and customer satisfaction.

										The Automotive Parts WordPress Theme is ideal for both new startups and well-established automotive businesses looking to enhance their digital presence. With seamless WooCommerce integration, you can effortlessly set up an online store and begin selling performance parts, racing accessories, or eco-friendly car parts right away. Whether your inventory includes fuel injectors, clutch kits, or brake rotors, the theme offers smooth product categorization and checkout flow. Use the “Meet the Team” section to introduce your experts, while offering detailed installation guides to build trust and reduce support queries. A built-in testimonial section boosts your brand’s credibility by showcasing positive customer feedback. Additionally, the theme includes a customizable blog area where you can share updates on new arrivals, maintenance tips, or automotive trends—perfect for engaging visitors and improving your SEO rankings.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'about' // Unique slug for the About page
			);
			wp_insert_post($automotive_parts_about);
		}

		// Create a Services page and assign the template
		$automotive_parts_services_title = 'Services';
		$automotive_parts_services_check = get_page_by_path('services');
		if (!$automotive_parts_services_check) {
			$automotive_parts_services = array(
				'post_type'    => 'page',
				'post_title'   => $automotive_parts_services_title,
				'post_content'   => '"More About The Free Automotive Parts WordPress Theme"
										This theme blends a sophisticated layout with automotive grit. Its clean interface features bold image sections, customizable banners, and crisp typography that highlights every product and service. Personalization is simple with multiple layout options, color pickers, and widgetized areas. You can tailor the homepage to feature car categories like car lights, transmission parts, or performance upgrades, while the inner pages allow showcasing of detailed inventory. Visual appeal meets practicality, offering responsive design that looks great on all devices and ensures a smooth browsing experience.

										The Automotive Parts WordPress Theme isn’t just about looks—it’s a powerful and comprehensive digital solution designed specifically for modern automotive businesses. Whether you specialize in aftermarket upgrades, OEM parts, truck accessories, car lights, or air conditioning parts, this theme allows you to professionally organize your entire inventory into clean, accessible categories. From the homepage to the checkout page, the user journey is seamless and intuitive, encouraging conversions. Showcase your products like brake pads, engine mounts, tire inflators, or spark plugs using the built-in image gallery, enhancing visibility and customer engagement. You can also highlight your company’s story, values, service guarantees, and team on dedicated inner pages, adding credibility and trust. With customization options to reflect your brand’s unique identity, this theme empowers you to create a tailored, user-focused shopping experience that supports both growth and customer satisfaction.

										The Automotive Parts WordPress Theme is ideal for both new startups and well-established automotive businesses looking to enhance their digital presence. With seamless WooCommerce integration, you can effortlessly set up an online store and begin selling performance parts, racing accessories, or eco-friendly car parts right away. Whether your inventory includes fuel injectors, clutch kits, or brake rotors, the theme offers smooth product categorization and checkout flow. Use the “Meet the Team” section to introduce your experts, while offering detailed installation guides to build trust and reduce support queries. A built-in testimonial section boosts your brand’s credibility by showcasing positive customer feedback. Additionally, the theme includes a customizable blog area where you can share updates on new arrivals, maintenance tips, or automotive trends—perfect for engaging visitors and improving your SEO rankings.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'services' // Unique slug for the Services page
			);
			wp_insert_post($automotive_parts_services);
		}


		// ------------------------------------------ Header -------------------------------------- //

			set_theme_mod('automotive_parts_add_location','Lorem ipsum dolor sit amet, consectetuer adipiscing.');
			set_theme_mod('automotive_parts_header_info_email','info@example.com');

			set_theme_mod('automotive_parts_service_show_hide',1);
			set_theme_mod('automotive_parts_enable_slider',1);
			set_theme_mod('automotive_parts_enable_slider',true);
			

		// ------------------------------------------ Slider Section -------------------------------------- //

			set_theme_mod('automotive_parts_slide_number','3');

			for($automotive_parts_i=1;$automotive_parts_i<=3;$automotive_parts_i++){
				set_theme_mod( 'automotive_parts_slider_image'.$automotive_parts_i,get_template_directory_uri().'/revolution/assets/images/slider'.$automotive_parts_i.'.png' );
				set_theme_mod( 'automotive_parts_slider_top_text'.$automotive_parts_i, 'POWER.PERFORMANCE.PRECISION.' );
				set_theme_mod( 'automotive_parts_slider_heading'.$automotive_parts_i, 'SERVICES & AFFORDABLE PRICE' );
				set_theme_mod( 'automotive_parts_slider_text'.$automotive_parts_i, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac lacinia lacus, id fermentum est. Etiam eget egestas nulla,' );
				set_theme_mod( 'automotive_parts_slider_button1_text'.$automotive_parts_i, 'READ MORE' );
				set_theme_mod( 'automotive_parts_slider_button2_text'.$automotive_parts_i, 'BOOK AN APPOINTMENT' );
				set_theme_mod( 'automotive_parts_slider_button1_link'.$automotive_parts_i, '#' );
				set_theme_mod( 'automotive_parts_slider_button2_link'.$automotive_parts_i, '#' );
			}

		// ------------------------------------------ Chef Section -------------------------------------- //

			set_theme_mod('automotive_parts_section_short_title','SERVICE TEAM');
			set_theme_mod('automotive_parts_section_title','Our Expert Mechanics.');

			$automotive_parts_team_role = array('JAMI DOE', 'AMMY WAY', 'SODHI LAN', 'JOHN MACK');

			for($automotive_parts_i=1;$automotive_parts_i<=4;$automotive_parts_i++) {
				set_theme_mod( 'automotive_parts_team_role'.$automotive_parts_i, $automotive_parts_team_role[$automotive_parts_i - 1]);
			}

			wp_delete_post(1);
			$blog_title = array(
				'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod ra maecenas accumsan lacus vel facilisis.',
				'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod ra maecenas accumsan lacus vel facilisis.',
				'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod ra maecenas accumsan lacus vel facilisis.',
				'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod ra maecenas accumsan lacus vel facilisis.'
			);
			
			for($i=1;$i<=4;$i++){
			$title =$blog_title[$i-1];
			$content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod ra maecenas accumsan lacus vel facilisis.';

			// Create post object
			$my_post = array(
				'post_title'    => wp_strip_all_tags( $title ),
				'post_content'  => $content,
				'post_status'   => 'publish',
				'post_type'     => 'post',
			);

			// Insert the post into the database
			$post_id = wp_insert_post( $my_post );

			$image_url = get_template_directory_uri().'/revolution/assets/images/about'.$i.'.png';

			$image_name= 'about'.$i.'.png';
			$upload_dir       = wp_upload_dir();
			// Set upload folder
			$image_data       = file_get_contents($image_url);
			// Get image data
			$unique_file_name = wp_unique_filename( $upload_dir['path'], $image_name );
			// Generate unique name
			$filename= basename( $unique_file_name );
			// Create image file name
			// Check folder permission and define file location
			if( wp_mkdir_p( $upload_dir['path'] ) ) {
				 $file = $upload_dir['path'] . '/' . $filename;
			} else {
				 $file = $upload_dir['basedir'] . '/' . $filename;
			}
			// Create the image  file on the server
			if ( ! function_exists( 'WP_Filesystem' ) ) {
				require_once( ABSPATH . 'wp-admin/includes/file.php' );
			}

			WP_Filesystem();
			global $wp_filesystem;

			if ( ! $wp_filesystem->put_contents( $file, $image_data, FS_CHMOD_FILE ) ) {
				wp_die( 'Error saving file!' );
			}
			// Check image file type
			$wp_filetype = wp_check_filetype( $filename, null );
			// Set attachment data
			$attachment = array(
			 'post_mime_type' => $wp_filetype['type'],
			 'post_title'     => sanitize_file_name( $filename ),
			 'post_content'   => '',
			 'post_type'     => 'post',
			 'post_status'    => 'inherit'
			);
			// Create the attachment
			$attach_id = wp_insert_attachment( $attachment, $file, $post_id );
			// Include image.php
			require_once(ABSPATH . 'wp-admin/includes/image.php');
			// Define attachment metadata
			$attach_data = wp_generate_attachment_metadata( $attach_id, $file );
			// Assign metadata to attachment
			 wp_update_attachment_metadata( $attach_id, $attach_data );
			// And finally assign featured image to post
			set_post_thumbnail( $post_id, $attach_id );
		}


  	 	$this->automotive_parts_customizer_nav_menu();
  	 	$this->automotive_parts_social_menu();
		update_option('automotive_parts_demo_imported', true);
	}

	public function automotive_parts_guide() {
		$display_string = '';
		$return = add_query_arg( array()) ;
		$theme = wp_get_theme( 'automotive-parts' );
		?>
		<div class="wrapper-info get-stared-page-wrap">
			<div class="wrapper-info-content">
				<div class="buynow__">
					<h2><?php esc_html_e( 'Welcome to Automotive Parts', 'automotive-parts' ); ?> <span class="version">Version: <?php echo esc_html($theme['Version']);?></span></h2>
					<p><?php esc_html_e('The quick setup wizard will assist you in configuring your new website. This wizard will import the demo content.', 'automotive-parts'); ?></p>
				</div>
				<div class="buynow_">
					<a target="_blank" class="buynow_themepage" href="<?php echo esc_url('https://www.revolutionwp.com/products/auto-parts-wordpress-theme'); ?>"><?php echo esc_html__('Go Premium Now', 'automotive-parts'); ?></a>
				</div>
			</div>
			<div class="tab-sec theme-option-tab">
				<div id="demo_offer" class="tabcontent open">
					<?php $this->wizard_page(); ?>
				</div>
			</div>
		</div>
	<?php }
}