<?php
/**
 * Wizard
 *
 * @package Whizzie
 * @author Catapult Themes
 * @since 1.0.0
 */


class ThemeWhizzie {

	public static $is_valid_key = 'false';
	public static $theme_key 		= '';

	protected $version = '1.1.0';

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

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

	/** @var array Wizard steps set by user. */
	protected $config_steps = array();

	/**
	 * Relative plugin url for this plugin folder
	 * @since 1.0.0
	 * @var string
	 */
	protected $plugin_url = '';

	/**
	 * TGMPA instance storage
	 *
	 * @var object
	 */
	protected $tgmpa_instance;

	/**
	 * TGMPA Menu slug
	 *
	 * @var string
	 */
	protected $tgmpa_menu_slug = 'tgmpa-install-plugins';

	/**
	 * TGMPA Menu url
	 *
	 * @var string
	 */
	protected $tgmpa_url = 'themes.php?page=tgmpa-install-plugins';

	// Where to find the widget.wie file
	protected $widget_file_url = '';

	/**
	 * Constructor
	 *
	 * @param $vw_book_store_pro_config	Our config parameters
	 */
	public function __construct( $vw_book_store_pro_config ) {
		$this->set_vars( $vw_book_store_pro_config );
		$this->init();

		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
	}

	public static function get_the_validation_status() {
		return get_option('vw_book_store_pro_theme_validation_status');
	}

	public static function set_the_validation_status($is_valid) {
		update_option('vw_book_store_pro_theme_validation_status', $is_valid);
	}

	public static function get_the_suspension_status() {
		return get_option( 'vw_book_store_pro_theme_suspension_status' );
	}

	public static function set_the_suspension_status( $is_suspended ) {
		update_option( 'vw_book_store_pro_theme_suspension_status' , $is_suspended );
	}
	
	public static function set_the_theme_key($the_key) {
		update_option('vw_pro_theme_key', $the_key);
	}

	public static function remove_the_theme_key() {
		delete_option('vw_pro_theme_key');
	}

	public static function get_the_theme_key() {
		return get_option('vw_pro_theme_key');
	}

	/**
	 * Set some settings
	 * @since 1.0.0
	 * @param $vw_book_store_pro_config	Our config parameters
	 */
	public function set_vars( $vw_book_store_pro_config ) {

		require_once trailingslashit( WHIZZIE_DIR ) . 'tgm/tgm.php';
		require_once trailingslashit( WHIZZIE_DIR ) . 'widgets/class-vw-widget-importer.php';

		if( isset( $vw_book_store_pro_config['page_slug'] ) ) {
			$this->page_slug = esc_attr( $vw_book_store_pro_config['page_slug'] );
		}
		if( isset( $vw_book_store_pro_config['page_title'] ) ) {
			$this->page_title = esc_attr( $vw_book_store_pro_config['page_title'] );
		}
		if( isset( $vw_book_store_pro_config['steps'] ) ) {
			$this->config_steps = $vw_book_store_pro_config['steps'];
		}

		$this->plugin_path = trailingslashit( dirname( __FILE__ ) );
		$relative_url = str_replace( get_template_directory(), '', $this->plugin_path );
		$this->plugin_url = trailingslashit( get_template_directory_uri() . $relative_url );
		$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 . '-wizard' );
		$this->parent_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_parent_slug', '' );

		$this->widget_file_url = trailingslashit( WHIZZIE_DIR ) . 'widgets/vw-book-store-pro-demo-widgets.wie';

	}

	/**
	 * Hooks and filters
	 * @since 1.0.0
	 */
	public function init() {

		if ( class_exists( 'TGM_Plugin_Activation' ) && isset( $GLOBALS['tgmpa'] ) ) {
			add_action( 'init', array( $this, 'get_tgmpa_instance' ), 30 );
			add_action( 'init', array( $this, 'set_tgmpa_url' ), 40 );
		}

		add_action( 'after_switch_theme', array( $this, 'redirect_to_wizard' ) );

		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
		add_action( 'admin_menu', array( $this, 'menu_page' ) );
		add_action( 'admin_init', array( $this, 'get_plugins' ), 30 );
		add_filter( 'tgmpa_load', array( $this, 'tgmpa_load' ), 10, 1 );
		add_action( 'wp_ajax_setup_plugins', array( $this, 'setup_plugins' ) );
		add_action( 'wp_ajax_setup_widgets', array( $this, 'setup_widgets' ) );

		add_action( 'wp_ajax_setup_builder', array( $this, 'setup_builder' ) );
		add_action( 'wp_ajax_wz_install_activate_ibtana', array( $this, 'wz_install_activate_ibtana' ) );

		add_action( 'wp_ajax_wz_activate_vw_book_store_pro', array( $this, 'wz_activate_vw_book_store_pro' ) );

		add_action('admin_enqueue_scripts',  array( $this, 'vw_book_store_pro_admin_theme_style' ) );
	

	}

	public function redirect_to_wizard() {
		global $pagenow;
		if( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) && current_user_can( 'manage_options' ) ) {
			wp_redirect( admin_url( 'themes.php?page=' . esc_attr( $this->page_slug ) ) );
		}
	}

	public function enqueue_scripts() {
		wp_enqueue_style( 'theme-wizard-style', get_template_directory_uri() . '/theme-wizard/assets/css/theme-wizard-style.css');
		wp_register_script( 'theme-wizard-script', get_template_directory_uri() . '/theme-wizard/assets/js/theme-wizard-script.js', array( 'jquery' ), time() );
		wp_localize_script(
			'theme-wizard-script',
			'vw_book_store_pro_whizzie_params',
			array(
				'ajaxurl' 		=> admin_url( 'admin-ajax.php' ),
				'wpnonce' 		=> wp_create_nonce( 'whizzie_nonce' ),
				'verify_text'	=> esc_html( 'verifying', 'vw-book-store-pro' ),
				'IBTANA_THEME_LICENCE_ENDPOINT' => IBTANA_THEME_LICENCE_ENDPOINT
			)
		);
		wp_enqueue_script( 'theme-wizard-script' );
		wp_enqueue_script('tabs', get_template_directory_uri() . '/theme-wizard/getstarted/js/tab.js');
		wp_enqueue_script( 'vw-notify-popup', get_template_directory_uri() . '/assets/js/notify.min.js');
	}

	public static function get_instance() {
		if ( ! self::$instance ) {
			self::$instance = new self;
		}
		return self::$instance;
	}

	public function tgmpa_load( $status ) {
		return is_admin() || current_user_can( 'install_themes' );
	}

	/**
	 * Get configured TGMPA instance
	 *
	 * @access public
	 * @since 1.1.2
	 */
	public function get_tgmpa_instance() {
		$this->tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
	}

	/**
	 * Update $tgmpa_menu_slug and $tgmpa_parent_slug from TGMPA instance
	 *
	 * @access public
	 * @since 1.1.2
	 */
	public function set_tgmpa_url() {
		$this->tgmpa_menu_slug = ( property_exists( $this->tgmpa_instance, 'menu' ) ) ? $this->tgmpa_instance->menu : $this->tgmpa_menu_slug;
		$this->tgmpa_menu_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_tgmpa_menu_slug', $this->tgmpa_menu_slug );
		$tgmpa_parent_slug = ( property_exists( $this->tgmpa_instance, 'parent_slug' ) && $this->tgmpa_instance->parent_slug !== 'themes.php' ) ? 'admin.php' : 'themes.php';
		$this->tgmpa_url = apply_filters( $this->theme_name . '_theme_setup_wizard_tgmpa_url', $tgmpa_parent_slug . '?page=' . $this->tgmpa_menu_slug );
	}

	/**
	 * 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, 'vw_book_store_pro_mostrar_guide' ) ,get_template_directory_uri().'/theme-wizard/assets/images/admin-menu.svg',40);
	}

	public function activation_page() {
		$theme_key 						= ThemeWhizzie::get_the_theme_key();
		$validation_status 		= ThemeWhizzie::get_the_validation_status();
		?>
		<div class="wrap">
			<label><?php esc_html_e('Enter Your Theme License Key:','vw-book-store-pro'); ?></label>
			<form id="vw_book_store_pro_license_form">
				<input type="text" name="vw_book_store_pro_license_key" value="<?php echo $theme_key ?>" <?php if($validation_status === 'true') { echo "disabled"; } ?> required placeholder="License Key" />
				<div class="licence-key-button-wrap">
					<button class="button" type="submit" name="button" <?php if($validation_status === 'true') { echo "disabled"; } ?>>
						<?php if ($validation_status === 'true') {
						?>
							Activated
						<?php
						} else { ?>
							Activate
						<?php
						}
						?>
					</button>

					<?php if ($validation_status === 'true') { ?>
						<button id="change--key" class="button" type="button" name="button">
							Change Key
						</button>
						<div class="next-button">
						<button id="start-now-next" class="button" type="button" name="button" onclick="openCity(event, 'demo_offer')">
							Next
						</button>
					</div>
					<?php } ?>
				</div>
			</form>
		</div>
		<?php
	}

	/**
	 * Make an interface for the wizard
	 */
	public function wizard_page() {

		tgmpa_load_bulk_installer();

		// install plugins with TGM.
		if ( ! class_exists( 'TGM_Plugin_Activation' ) || ! isset( $GLOBALS['tgmpa'] ) ) {
			die( 'Failed to find TGM' );
		}
		$url = wp_nonce_url( add_query_arg( array( 'plugins' => 'go' ) ), 'whizzie-setup' );

		// copied from TGM
		$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
		$fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem.
		if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, $fields ) ) ) {
			return true; // Stop the normal page form from displaying, credential request form will be shown.
		}
		// Now we have some credentials, setup WP_Filesystem.
		if ( ! WP_Filesystem( $creds ) ) {
			// Our credentials were no good, ask the user for them again.
			request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, $fields );
			return true;
		}


		/* If we arrive here, we have the filesystem */ ?>
		<div class="wrap">
			<div class="wizard-logo-wrap">
				<img src="<?php echo esc_url(get_template_directory_uri().'/theme-wizard/assets/images/adminIcon.png'); ?>">
				<span class="wizard-main-title">
					<?php esc_html_e('Welcome to ','vw-book-store-pro'); echo $this->theme_title; ?>
				</span>
			</div>
			<?php echo '<div class="card whizzie-wrap">';
				// The wizard is a list with only one item visible at a time
				$steps = $this->get_steps();
				echo '<ul class="whizzie-menu vw-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 ) . '" >';
						printf( '<span class="wizard-main-title">%s</span>',
							esc_html( $step['title'] )
							);
						// $content is split into summary and detail
						$content = call_user_func( array( $this, $step['view'] ) );
						if( isset( $content['summary'] ) ) {
							printf(
								'<div class="summary">%s</div>',
								wp_kses_post( $content['summary'] )
							);
						}
						if( isset( $content['detail'] ) ) {
							// Add a link to see more detail
							printf( '<div class="wz-require-plugins">');
							printf(
								'<div class="detail">%s</div>',
								$content['detail'] // Need to escape this
							);
							printf('</div>');
						}

						printf('<div class="wizard-button-wrapper">');
						  if (ThemeWhizzie::get_the_validation_status() === 'true') {
							// The next button
							if( isset( $step['button_text'] ) && $step['button_text'] ) {
								printf(
									'<div class="button-wrap"><a href="#" class="button button-primary do-it" data-callback="%s" data-step="%s">%s</a></div>',
									esc_attr( $step['callback'] ),
									esc_attr( $step['id'] ),
									esc_html( $step['button_text'] )
								);
							}

							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"><img src="'.get_template_directory_uri().'/theme-wizard/assets/images/Customize-Icon.png"></a>
										<p class="demo-type-text">%s</p>
									</div>',
									esc_html( $step['button_text_one'] )
								);
							}
							if( isset( $step['button_text_two'] )) {
								printf(
									'<div class="button-wrap button-wrap-two">
										<a href="#" class="button button-primary do-it" data-step="widgets" data-callback="page_builder" id="ibtana_button"><img src="'.get_template_directory_uri().'/theme-wizard/assets/images/Gutenberg-Icon.png"></a>
										<p class="demo-type-text">%s</p>
									</div>',
									esc_html( $step['button_text_two'] )
								);
							}
							
						} else {
							printf(
								'<div class="button-wrap"><a href="#" class="button button-primary key-activation-tab-click">%s</a></div>',
								esc_html( __( 'Activate Your License', 'vw-book-store-pro' ) )
							);
						}
						printf('</div>');

					echo '</li>';
				}
				echo '</ul>';
				echo '<ul class="whizzie-nav wizard-icon-nav">';
					$stepI=1;
					foreach( $steps as $step ) {
						$stepAct=($stepI ==1)? 1 : 0;
						if( isset( $step['icon_url'] ) && $step['icon_url'] ) {
							echo '<li class="nav-step-' . esc_attr( $step['id'] ) . '" wizard-steps="step-'.esc_attr( $step['id'] ).'" data-enable="'.$stepAct.'">
							<img src="'.esc_attr( $step['icon_url'] ).'">
							</li>';
						}
					$stepI++;}
				echo '</ul>';
				?>
				<div class="step-loading"><span class="spinner">
					<img src="<?php echo esc_url(get_template_directory_uri().'/theme-wizard/assets/images/Spinner-Animaion.gif'); ?>">
				</span></div>
			<?php echo '</div>';?>

		</div>
	<?php }
	/**
	 * Set options for the steps
	 * Incorporate any options set by the theme dev
	 * Return the array for the steps
	 * @return Array
	 */
	public function get_steps() {
		$dev_steps = $this->config_steps;
		$steps = array(
			'intro' => array(
				'id'			=> 'intro',
				'title'			=> __( '', 'vw-book-store-pro' ),
				'icon'			=> 'dashboard',
				'view'			=> 'get_step_intro', // Callback for content
				'callback'		=> 'do_next_step', // Callback for JS
				'button_text'	=> __( 'Start Now', 'vw-book-store-pro' ),
				'can_skip'		=> false, // Show a skip button?
				'icon_url'      => get_template_directory_uri().'/theme-wizard/assets/images/Icons-01.svg'
			),
			'plugins' => array(
				'id'			=> 'plugins',
				'title'			=> __( 'Plugins', 'vw-book-store-pro' ),
				'icon'			=> 'admin-plugins',
				'view'			=> 'get_step_plugins',
				'callback'		=> 'install_plugins',
				'button_text'	=> __( 'Install Plugins', 'vw-book-store-pro' ),
				'can_skip'		=> true,
				'icon_url'      => get_template_directory_uri().'/theme-wizard/assets/images/Icons-02.svg'
			),
			'widgets' => array(
				'id'			=> 'widgets',
				'title'			=> __( 'Customizer', 'vw-book-store-pro' ),
				'icon'			=> 'welcome-widgets-menus',
				'view'			=> 'get_step_widgets',
				'callback'		=> 'install_widgets',
				'button_text_one'	=> __( 'Click On The Image To Import Customizer Demo', 'vw-book-store-pro' ),
				'button_text_two'	=> __( 'Click On The Image To Import Gutenberg Block Demo', 'vw-book-store-pro' ),
				'can_skip'		=> true,
				'icon_url'      => get_template_directory_uri().'/theme-wizard/assets/images/Icons-03.svg'
			),
			
			'done' => array(
				'id'			=> 'done',
				'title'			=> __( 'All Done', 'vw-book-store-pro' ),
				'icon'			=> 'yes',
				'view'			=> 'get_step_done',
				'callback'		=> '',
				'icon_url'      => get_template_directory_uri().'/theme-wizard/assets/images/Icons-04.svg'
			)
		);

		// 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','button_text_two' );
			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_intro() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('Thank you for choosing this '.$this->theme_title.' 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.','vw-book-store-pro'); ?>
			</p>
			<p>
				<?php esc_html_e('You may even skip the steps and get back to the dashboard if you have no time at the present moment. You can come back any time if you change your mind.','vw-book-store-pro'); ?>
			</p>
		</div>
	<?php }

	public function get_step_importer() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('Thank you for choosing this '.$this->theme_title.' 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.','vw-book-store-pro'); ?>
			</p>
		</div>
	<?php }
	/**
	 * Get the content for the plugins step
	 * @return $content Array
	 */
	public function get_step_plugins() {
		$plugins = $this->get_plugins();
		$content = array(); ?>
			<div class="summary">
				<p>
					<?php esc_html_e('Additional plugins always make your website exceptional. Install these plugins by clicking the install button. You may also deactivate them from the dashboard.','vw-book-store-pro') ?>
				</p>
			</div>
		<?php // The detail element is initially hidden from the user
		$content['detail'] = '<span class="wizard-plugin-count">'.count($plugins['all']).'</span><ul class="whizzie-do-plugins">';
		// Add each plugin into a list
		foreach( $plugins['all'] as $slug=>$plugin ) {
			$content['detail'] .= '<li data-slug="' . esc_attr( $slug ) . '">' . esc_html( $plugin['name'] ) . '<div class="wizard-plugin-title">';

			$content['detail'] .= '<span class="wizard-plugin-status">Installation Required</span><i class="spinner"></i></div></li>';
			
		}
		$content['detail'] .= '</ul>';

		return $content;
	}

	
	/**
	 * Print the content for the widgets step
	 * @since 1.1.0
	 */
	public function get_step_widgets() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('This theme supports importing the demo content and adding widgets. Get them installed with the below button. Using the Customizer, it is possible to update or even deactivate them','vw-book-store-pro'); ?>
			</p>
		</div>
	<?php }


	/**
	 * Print the content for the Design choices for the user
	 */

	public function get_step_design() { ?>

		<div class="ibtana-design-product-row">
		</div> 
		<div class="wizard-design-button-wrapper">
			<a href="#" class="button button-primary do-it" data-step="design" id="IbtanaImportButton" data-callback="inner_page_builder">Import</a>
		</div>

	<?php }
	/**
	 * Print the content for the final step
	 */
	public function get_step_done() {

	 ?>

		<div class="vw-setup-finish">
			<p>
				<?php echo esc_html('Your demo content has been imported successfully . Click on the finish button for more information.'); ?>
			</p>
			<div class="finish-buttons">
				<a href="<?php echo esc_url(admin_url('/customize.php')); ?>" class="wz-btn-customizer" target="_blank"><?php esc_html_e('Customize Your Demo','vw-book-store-pro') ?></a>
				<a href="" class="wz-btn-builder" target="_blank"><?php esc_html_e('Customize Your Demo','vw-book-store-pro'); ?></a>
				<a href="<?php echo esc_url(site_url()); ?>" class="wz-btn-visit-site" target="_blank"><?php esc_html_e('Visit Your Site','vw-book-store-pro'); ?></a>
			</div>
			<div class="vw-finish-btn">
				<a href="javascript:void(0);" class="button button-primary" onclick="openCity(event, 'theme_info')" data-tab="theme_info">Finish</a>
			</div>
		</div>

	<?php }

	/**
	 * Get the plugins registered with TGMPA
	 */
	public function get_plugins() {

		$instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) );
		$plugins = array(
			'all' 		=> array(),
			'install'	=> array(),
			'update'	=> array(),
			'activate'	=> array()
		);
		foreach( $instance->plugins as $slug=>$plugin ) {
			if( $instance->is_plugin_active( $slug ) && false === $instance->does_plugin_have_update( $slug ) ) {
				// Plugin is installed and up to date
				continue;
			} else {
				$plugins['all'][$slug] = $plugin;
				if( ! $instance->is_plugin_installed( $slug ) ) {
					$plugins['install'][$slug] = $plugin;
				} else {
					if( false !== $instance->does_plugin_have_update( $slug ) ) {
						$plugins['update'][$slug] = $plugin;
					}
					if( $instance->can_plugin_activate( $slug ) ) {
						$plugins['activate'][$slug] = $plugin;
					}
				}
			}
		}
		return $plugins;
	}

	public function setup_plugins() {

		if ( ! check_ajax_referer( 'whizzie_nonce', 'wpnonce' ) || empty( $_POST['slug'] ) ) {
			wp_send_json_error( array( 'error' => 1, 'message' => esc_html__( 'No Slug Found','vw-book-store-pro' ) ) );
		}
		$json = array();
		// send back some json we use to hit up TGM
		$plugins = $this->get_plugins();

		// what are we doing with this plugin?
		foreach ( $plugins['activate'] as $slug => $plugin ) {
			if ( $_POST['slug'] == $slug ) {
				$json = array(
					'url'           => admin_url( $this->tgmpa_url ),
					'plugin'        => array( $slug ),
					'tgmpa-page'    => $this->tgmpa_menu_slug,
					'plugin_status' => 'all',
					'_wpnonce'      => wp_create_nonce( 'bulk-plugins' ),
					'action'        => 'tgmpa-bulk-activate',
					'action2'       => - 1,
					'message'       => esc_html__( 'Activating Plugin','vw-book-store-pro' ),
				);
				break;
			}
		}
		foreach ( $plugins['update'] as $slug => $plugin ) {
			if ( $_POST['slug'] == $slug ) {
				$json = array(
					'url'           => admin_url( $this->tgmpa_url ),
					'plugin'        => array( $slug ),
					'tgmpa-page'    => $this->tgmpa_menu_slug,
					'plugin_status' => 'all',
					'_wpnonce'      => wp_create_nonce( 'bulk-plugins' ),
					'action'        => 'tgmpa-bulk-update',
					'action2'       => - 1,
					'message'       => esc_html__( 'Updating Plugin','vw-book-store-pro' ),
				);
				break;
			}
		}
		foreach ( $plugins['install'] as $slug => $plugin ) {
			if ( $_POST['slug'] == $slug ) {
				$json = array(
					'url'           => admin_url( $this->tgmpa_url ),
					'plugin'        => array( $slug ),
					'tgmpa-page'    => $this->tgmpa_menu_slug,
					'plugin_status' => 'all',
					'_wpnonce'      => wp_create_nonce( 'bulk-plugins' ),
					'action'        => 'tgmpa-bulk-install',
					'action2'       => - 1,
					'message'       => esc_html__( 'Installing Plugin','vw-book-store-pro' ),
				);
				break;
			}
		}
		if ( $json ) {
			$json['hash'] = md5( serialize( $json ) ); // used for checking if duplicates happen, move to next plugin
			wp_send_json( $json );
		} else {
			wp_send_json( array( 'done' => 1, 'message' => esc_html__( 'Success','vw-book-store-pro' ) ) );
		}
		exit;
	}
public function theme_create_customizer_nav_menu()
		{

		 // ------- Create Nav Menu --------
        $menuname = $lblg_themename . 'Primary Menu';
		$bpmenulocation = 'primary';
		$menu_exists = wp_get_nav_menu_object( $menuname );

		if( !$menu_exists){
		    $menu_id = wp_create_nav_menu($menuname);
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Home'),
		        'menu-item-classes' => 'home',
		        'menu-item-url' => home_url( '/' ), 
		        'menu-item-status' => 'publish'));

		    $parent_item = wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' => __('Blog','vw-book-store-pro'),
				'menu-item-status' => 'publish'
			));
			wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' => __('Blog With No Sidebar','vw-book-store-pro'),
				'menu-item-classes' => 'blog-left-sidebar',
				'menu-item-url' => home_url( '/index.php/blog/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_item
			));
			wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' => __('Blog Left Sidebar','vw-book-store-pro'),
				'menu-item-classes' => 'blog-left-sidebar',
				'menu-item-url' => home_url( '/index.php/blog-left-sidebar/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_item
			));
			wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' => __('Blog Right Sidebar','vw-book-store-pro'),
				'menu-item-classes' => 'blog-right-sidebar',
				'menu-item-url' => home_url( '/index.php/blog-right-sidebar/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_item
			));

			 $parent_page_item = wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Page','vw-book-store-pro'),
		        'menu-item-classes' => 'page',
		        'menu-item-status' => 'publish'));

			wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' => __('Page With No Sidebar','vw-book-store-pro'),
				'menu-item-classes' => 'page',
				'menu-item-url' => home_url( '/index.php/page/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));

		    wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' => __('Page Left Sidebar','vw-book-store-pro'),
				'menu-item-classes' => 'page-left',
				'menu-item-url' => home_url( '/index.php/page-left/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));

			wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' => __('Page Right Sidebar','vw-book-store-pro'),
				'menu-item-classes' => 'page-right',
				'menu-item-url' => home_url( '/index.php/page-right/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));
				wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Typography','vw-book-store-pro'),
				'menu-item-classes' => 'typography',
				'menu-item-url' => home_url( '/index.php/typography/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));
				wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Error 404','vw-book-store-pro'),
				'menu-item-classes' => 'error',
				'menu-item-url' => home_url( '/index.php/404.php/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));
				wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Faq','vw-book-store-pro'),
				'menu-item-classes' => 'faq',
				'menu-item-url' => home_url( '/index.php/faq/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));
				wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Book Author','vw-book-store-pro'),
				'menu-item-classes' => 'book-author',
				'menu-item-url' => home_url( '/index.php/book-author/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));
				wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Our Services','vw-book-store-pro'),
				'menu-item-classes' => 'our-services',
				'menu-item-url' => home_url( '/index.php/our-services/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $parent_page_item
			));
				$shop_parent_item = wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Shop','vw-book-store-pro'),
		        'menu-item-status' => 'publish'));

		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Product List','vw-book-store-pro'),
		        'menu-item-classes' => 'shop',
		        'menu-item-url' => home_url( '/index.php/shop/' ),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_parent_item
		    ));		    
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Simple Product','vw-book-store-pro'),
		        'menu-item-classes' => 'simple-product',
		        'menu-item-url' => home_url( '/index.php/product/marketing-management/' ),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_parent_item
		    ));
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Variable Product','vw-book-store-pro'),
		        'menu-item-classes' => 'variable-product',
		        'menu-item-url' => home_url( '/index.php/product/software-engineering/' ),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_parent_item
		    ));
		    $shop_child_item = wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Shop Layout','vw-book-store-pro'),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_parent_item
		    ));
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('2 Columns','vw-book-store-pro'),
		        'menu-item-classes' => '2-columns',
		        'menu-item-url' => home_url( '/index.php/2-columns/' ),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_child_item
		    ));
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('3 Columns','vw-book-store-pro'),
		        'menu-item-classes' => '3-column',
		        'menu-item-url' => home_url( '/index.php/3-column/' ),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_child_item
		    ));
		   wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('4 Columns','vw-book-store-pro'),
		        'menu-item-classes' => '4-column',
		        'menu-item-url' => home_url( '/index.php/4-column/' ),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_child_item
		    ));
		   
		     $shopp_child_item = wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Shop Pages','vw-book-store-pro'),
		        'menu-item-status' => 'publish',
		        'menu-item-parent-id' => $shop_parent_item
		    ));
			wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Cart','vw-book-store-pro'),
				'menu-item-classes' => 'cart',
				'menu-item-url' => home_url( '/index.php/cart/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $shopp_child_item
			));
			wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Checkout','vw-book-store-pro'),
				'menu-item-classes' => 'checkoutt',
				'menu-item-url' => home_url( '/index.php/checkout/' ),
				'menu-item-status' => 'publish',
				'menu-item-parent-id' => $shopp_child_item
			));
			wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('About Us','vw-book-store-pro'),
		        'menu-item-classes' => 'about-us',
		        'menu-item-url' => home_url( '/index.php/about-us/' ),
		        'menu-item-status' => 'publish'));
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Contact'),
		        'menu-item-classes' => 'contact',
		        'menu-item-url' => home_url( '/index.php/contact/' ), 
		        'menu-item-status' => 'publish'));

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


public function theme_create_customizer_footer_nav_menu() {

		 // ------- Create Nav Menu --------
        $menuname = $lblg_themename . 'Footer Menu1';
		$bpmenulocation = 'footer1';
		$menu_exists = wp_get_nav_menu_object( $menuname );

		if( !$menu_exists){
		    $menu_id = wp_create_nav_menu($menuname);
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Home','vw-book-store-pro'),
		        'menu-item-classes' => 'home',
		        'menu-item-url' => home_url( '/' ),
		        'menu-item-status' => 'publish'));

		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Blog','vw-book-store-pro'),
		        'menu-item-classes' => 'blog',
		        'menu-item-url' => home_url( '/index.php/blog/' ),
		        'menu-item-status' => 'publish'));
             wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Contact'),
		        'menu-item-classes' => 'contact',
		        'menu-item-url' => home_url( '/index.php/contact/' ), 
		        'menu-item-status' => 'publish'));
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Page','vw-book-store-pro'),
		        'menu-item-classes' => 'page',
		        'menu-item-url' => home_url( '/index.php/page/' ),
		        'menu-item-status' => 'publish'));

		    
		    if( !has_nav_menu( $bpmenulocation ) ){
		        $locations = get_theme_mod('nav_menu_locations');
		        $locations[$bpmenulocation] = $menu_id;
		        set_theme_mod( 'nav_menu_locations', $locations );
		    }
		}
	}
	public function theme_create_customizer_footers_nav_menu() {

		 // ------- Create Nav Menu --------
        $menuname = $lblg_themename . 'Footer Menu2';
		$bpmenulocation = 'footer2';
		$menu_exists = wp_get_nav_menu_object( $menuname );

		if( !$menu_exists){
		    $menu_id = wp_create_nav_menu($menuname);
		    wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('My Account','vw-book-store-pro'),
		        'menu-item-classes' => 'my-account',
		        'menu-item-url' => home_url( '/index.php/my-account/' ),
		        'menu-item-status' => 'publish'));
             wp_update_nav_menu_item($menu_id, 0, array(
		        'menu-item-title' =>  __('Checkout'),
		        'menu-item-classes' => 'checkout',
		        'menu-item-url' => home_url( '/index.php/checkout/' ), 
		        'menu-item-status' => 'publish'));
		   wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Cart','vw-book-store-pro'),
				'menu-item-classes' => 'cart',
				'menu-item-url' => home_url( '/index.php/cart/' ),
				'menu-item-status' => 'publish',
			));
		    wp_update_nav_menu_item($menu_id, 0, array(
				'menu-item-title' =>  __('Shop','vw-book-store-pro'),
				'menu-item-classes' => 'shop',
				'menu-item-url' => home_url( '/index.php/shop/' ),
				'menu-item-status' => 'publish',
			));

		    
		    if( !has_nav_menu( $bpmenulocation ) ){
		        $locations = get_theme_mod('nav_menu_locations');
		        $locations[$bpmenulocation] = $menu_id;
		        set_theme_mod( 'nav_menu_locations', $locations );
		    }
		}
	}
	public function custom_posttype_option(){
  $getOption = get_option('icpa_settings');

  $support_arr =array(
    'title' => 'on',
    'editor' => 'on',
    'thumbnail' => 'on',
    'custom-fields' => 'on',
    'page-attributes' => 'on',
    'comments' => 'on'
  );

  $posttype_arr = array(
    array(
      'posttype_name' => 'testimonials',
      'plural_label' => 'Testimonials',
      'singular_label' => 'Testimonials',
      'support' => $support_arr,
      'is_display' => 1,
    ),
    array(
      'posttype_name' => 'vw_author',
      'plural_label' => 'Author',
      'singular_label' => 'Author',
      'support' => $support_arr,
      'is_display' => 1,
    )
  );

  foreach ($posttype_arr as $posttype) {
    if ($getOption) {
      array_push($getOption, $posttype);
    }else{
      $getOption = [];
      array_push($getOption, $posttype);
    }
  }

  return update_option('icpa_settings', $getOption);
}
	 function isAssoc( array $arr ) {
		if (array() === $arr) return false;
		return array_keys($arr) !== range(0, count($arr) - 1);
	}

	/**
	 * Imports the Demo Content
	 * @since 1.1.0
	 */
		public function setup_widgets() 
		{
		$this->custom_posttype_option();

		// vw_title_banner_image_wp_custom_attachment START
		$image_url 	= get_template_directory_uri().'/assets/images/title-banner.png';
		$upload_dir = wp_upload_dir();
		$image_data = file_get_contents( $image_url );
		$filename = basename( $image_url );
		if ( wp_mkdir_p( $upload_dir['path'] ) ) {
		  $file = $upload_dir['path'] . '/' . $filename;
		} else {
		  $file = $upload_dir['basedir'] . '/' . $filename;
		}
		file_put_contents( $file, $image_data );
		$wp_filetype = wp_check_filetype( $filename, null );
		$attachment = array(
		  'post_mime_type'	=> $wp_filetype['type'],
		  'post_title' 			=> sanitize_file_name( $filename ),
		  'post_content' 		=> '',
		  'post_status' 		=> 'inherit'
		);
		$attach_id = wp_insert_attachment( $attachment, $file );
		require_once( ABSPATH . 'wp-admin/includes/image.php' );
		$attach_data = wp_generate_attachment_metadata( $attach_id, $file );
		wp_update_attachment_metadata( $attach_id, $attach_data );
		$attachment_url = wp_get_attachment_url( $attach_id );
		// vw_title_banner_image_wp_custom_attachment END

		//POST and update the customizer and other related data of VW Video Vlog Pro
        $home_id=''; $vw_blog_id=''; $page_id=''; $contact_id='';
        	// Create a front page and assigned the template
	        $home_title = 'Home';
	   		$home_check = get_page_by_title($home_title);
		   	$home = array(
	   		   'post_type' => 'page',
	   		   'post_title' => $home_title,
	   		   'post_status' => 'publish',
	   		   'post_author' => 1,
	   		   'post_slug' => 'home'
			);
	        $home_id = wp_insert_post($home);
			//Set the home page template
			add_post_meta( $home_id, '_wp_page_template', 'page-template/home-page.php' );

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

			// Create a blog page and assigned the template
			$blog_title = 'Blog';
			$blog_check = get_page_by_title($blog_title);
			$blog = array(
				'post_type' => 'page',
				'post_title' => $blog_title,
				'post_status' => 'publish',
				'post_author' => 1,
				'post_slug' => 'blog'
			);
			$blog_id = wp_insert_post($blog);

			//Set the blog page template
			add_post_meta( $blog_id, '_wp_page_template', 'page-template/blog-fullwidth-extend.php' );
			add_post_meta( $blog_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

			$blog_title = 'Blog Left Sidebar';
		$blog = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $blog_title,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'blog-left-sidebar'
		);
		$blog_id = wp_insert_post($blog);


		//Set the blog page template
		add_post_meta( $blog_id, '_wp_page_template', 'page-template/blog-with-left-sidebar.php' );
		add_post_meta( $blog_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );


		$blog_title = 'Blog Right Sidebar';
		$blog = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $blog_title,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'blog-right-sidebar'
		);
		$blog_id = wp_insert_post($blog);


		//Set the blog page template
		add_post_meta( $blog_id, '_wp_page_template', 'page-template/blog-with-right-sidebar.php' );
		add_post_meta( $blog_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

			// Create a Page 
		if( get_page_by_title( 'Page' ) == NULL ) {
			$page_title = 'Page ';
			$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, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est. laborum.ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';

			$page_check = get_page_by_title($page_title);
			$page = array(
				'post_type' => 'page',
				'post_title' => $page_title,
				'post_content'  => $content,
				'post_status' => 'publish',
				'post_author' => 1,
				'post_slug' => 'page'
			);
			$page_id = wp_insert_post($page);
			add_post_meta( $page_id , 'vw_title_banner_image_wp_custom_attachment', $attachment_url );
            $page_title = 'Page Left Sidebar';
			$content = 'Te obtinuit ut adepto satis somno. Aliisque institoribus iter deliciae vivet vita. Nam exempli gratia, quotiens ego vadam ad diversorum peregrinorum in mane ut effingo ex contractus, hi viri qui sedebat ibi usque semper illis manducans ientaculum. Solum cum bulla ut debui; EGO youd adepto a macula proiciendi. Sed quis scit si forte quod esset optima res pro me. sicut ea quae sentio. Qui vellem cadunt off ius desk ejus! Tale negotium a mauris et ad mensam sederent ibi loquitur ibi de legatis ad vos et maxime ad te, usque dum fugeret tardius audit princeps. Bene tamen fiduciam Ego got off semelTe obtinuit ut adepto satis somno. Aliisque institoribus iter deliciae vivet vita. Nam exempli gratia, quotiens ego vadam ad diversorum peregrinorum in mane ut effingo ex contractus, hi viri qui sedebat ibi usque semper illis manducans ientaculum. Solum cum bulla ut debui; EGO youd adepto a macula proiciendi. Sed quis scit si forte quod esset optima res pro me. sicut ea quae sentio. Qui vellem cadunt off ius desk ejus! Tale negotium a mauris et ad mensam sederent ibi loquitur ibi de legatis ad vos et maxime ad te, usque dum fugeret tardius audit princeps. Bene tamen fiduciam Ego got off semel.';

			$page_check = get_page_by_title($page_title);
			$vw_page = array(
				'post_type' 		=> 'page',
				'post_title' 		=> $page_title,
				'post_content'	=> $content,
				'post_status' 	=> 'publish',
				'post_author' 	=> 1,
				'post_slug' 		=> 'page-left'
			);
			$page_id = wp_insert_post($vw_page);

			//Set the blog page template
			add_post_meta( $page_id, '_wp_page_template', 'page-template/page-with-left-sidebar.php' );
			add_post_meta( $page_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );


			$page_title = 'Page Right Sidebar';
			$content = 'Te obtinuit ut adepto satis somno. Aliisque institoribus iter deliciae vivet vita. Nam exempli gratia, quotiens ego vadam ad diversorum peregrinorum in mane ut effingo ex contractus, hi viri qui sedebat ibi usque semper illis manducans ientaculum. Solum cum bulla ut debui; EGO youd adepto a macula proiciendi. Sed quis scit si forte quod esset optima res pro me. sicut ea quae sentio. Qui vellem cadunt off ius desk ejus! Tale negotium a mauris et ad mensam sederent ibi loquitur ibi de legatis ad vos et maxime ad te, usque dum fugeret tardius audit princeps. Bene tamen fiduciam Ego got off semelTe obtinuit ut adepto satis somno. Aliisque institoribus iter deliciae vivet vita. Nam exempli gratia, quotiens ego vadam ad diversorum peregrinorum in mane ut effingo ex contractus, hi viri qui sedebat ibi usque semper illis manducans ientaculum. Solum cum bulla ut debui; EGO youd adepto a macula proiciendi. Sed quis scit si forte quod esset optima res pro me. sicut ea quae sentio. Qui vellem cadunt off ius desk ejus! Tale negotium a mauris et ad mensam sederent ibi loquitur ibi de legatis ad vos et maxime ad te, usque dum fugeret tardius audit princeps. Bene tamen fiduciam Ego got off semel.';

			$page_check = get_page_by_title($page_title);
			$vw_page = array(
				'post_type' 		=> 'page',
				'post_title' 		=> $page_title,
				'post_content'	=> $content,
				'post_status' 	=> 'publish',
				'post_author' 	=> 1,
				'post_slug' 		=> 'page-right'
			);
			$page_id = wp_insert_post($vw_page);

			//Set the blog page template
			add_post_meta( $page_id, '_wp_page_template', 'page-template/page-with-right-sidebar.php' );
			add_post_meta( $page_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );
		}

			// Create a contact page and assigned the template
			$contact_title = 'Contact';
			$contact_check = get_page_by_title($contact_title);
			$contact = array(
				'post_type' => 'page',
				'post_title' => $contact_title,
				'post_status' => 'publish',
				'post_author' => 1,
				'post_slug' => 'contact'
			);
			$contact_id = wp_insert_post($contact);

			//Set the blog with right sidebar template
			add_post_meta( $contact_id, '_wp_page_template', 'page-template/contact.php' );
            add_post_meta( $contact_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

	    $menu_title = '2 Columns';
		$content = '[products  columns="2" orderby="date" order="DESC" visibility="visible"]';
		$menu = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $menu_title,
			'post_content'  => $content,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'page'
		);
		$menu_id = wp_insert_post($menu);

		//Set the blog with right sidebar template
		add_post_meta( $menu_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

		// Create a contact page and assigned the template
		$menu_title = '3 Columns';
		$content = '[products  columns="3" orderby="date" order="DESC" visibility="visible"]';
		$menu = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $menu_title,
			'post_content'  => $content,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'page'
		);
		$menu_id = wp_insert_post($menu);

		//Set the blog with right sidebar template
		add_post_meta( $menu_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

		// Create a contact page and assigned the template
		$menu_title = '4 Columns';
		$content = '[products  columns="4" orderby="date" order="DESC" visibility="visible"]';
		$menu = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $menu_title,
			'post_content'  => $content,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'page'
		);
		$menu_id = wp_insert_post($menu);

		//Set the blog with right sidebar template
		add_post_meta( $menu_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

         $typography_title = 'Typography';
		$typography = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $typography_title,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'typography'
		);
		$typography_id = wp_insert_post($typography);

		//Set the blog with right sidebar template
		add_post_meta( $typography_id, '_wp_page_template', 'page-template/typography-template.php' );
		add_post_meta( $typography_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );
        
         $faq_title = 'Faq';
		  $faq = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $faq_title,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'faq'
		);
		$faq_id = wp_insert_post($faq);

		//Set the blog with right sidebar template
		add_post_meta( $faq_id, '_wp_page_template', 'page-template/faq.php' );
		add_post_meta( $faq_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

		$prodauthor_title = 'Book Author';
		  $prodauthor = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $prodauthor_title,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'prodauthor'
		);
		$prodauthor_id = wp_insert_post($prodauthor);

		//Set the blog with right sidebar template
		add_post_meta( $prodauthor_id, '_wp_page_template', 'page-template/product-author.php' );
		add_post_meta( $prodauthor_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

		$ourservices_title = 'Our Services';
		  $ourservices= array(
			'post_type' 	=> 'page',
			'post_title' 	=> $ourservices_title,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'ourservices'
		);
		$ourservices_id = wp_insert_post($ourservices);

		//Set the blog with right sidebar template
		add_post_meta( $ourservices_id, '_wp_page_template', 'page-template/our-services.php' );
		add_post_meta( $ourservices_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

		$about_title = 'About Us';
		  $about = array(
			'post_type' 	=> 'page',
			'post_title' 	=> $about_title,
			'post_status' => 'publish',
			'post_author' => 1,
			'post_slug' 	=> 'about-us'
		);
		$about_id = wp_insert_post($about);

		//Set the blog with right sidebar template
		add_post_meta( $about_id, '_wp_page_template', 'page-template/About-template.php' );
		add_post_meta( $about_id, 'vw_title_banner_image_wp_custom_attachment', $attachment_url );

			// -------------- Section Ordering ---------------

         set_theme_mod( 'vw_book_store_pro_section_ordering_settings_repeater', 'slider,about,trending-product,product-category,latest-collection,our-records,best-seller,our-author,our-partners,testimonial,latest-posts,newsletter,content-area' );

         set_theme_mod( 'vw_book_store_pro_search_placeholder_text', 'Search Here' );


         // Attribute Creation Code if a variable product needed to create
		$attribute_data = array(
			array(
				'name'					=>	'Fiction',
				'type'					=>	'button',
				'taxonomy'			=>	'pa_fiction',
				'data'					=>	array(
					'Horror',
					'Thriller'
				)
			),
			
		);
		$new_attribute_data = array();
		$old_attribute_taxonomies = wc_get_attribute_taxonomies();
		foreach ( $attribute_data as $attribute_data_single ) {
			$is_attribute_found	=	false;
			foreach ( $old_attribute_taxonomies as $old_attribute_taxonomy ) {
				if ( $attribute_data_single['type'] === $old_attribute_taxonomy->attribute_type ) {
					$is_attribute_found = true;
					break;
				}
			}
			if ( !$is_attribute_found ) {
				array_push( $new_attribute_data, $attribute_data_single );
			}
		}
		foreach ( $new_attribute_data as $attribute_single_args ) {
			$args = array(
				// 'slug'					=> 'my_color',
				'name'					=>	__( $attribute_single_args['name'], 'vw-book-store-pro' ),
				'type'					=>	$attribute_single_args['type'],
				'orderby'				=>	'menu_order',
				'has_archives'	=>	false,
			);
			$wc_create_attribute	=	wc_create_attribute( $args );
			register_taxonomy( $attribute_single_args['taxonomy'], array( 'product' ), array() );

			if ( !is_wp_error( $wc_create_attribute ) ) {

				if ( $this->isAssoc( $attribute_single_args['data'] ) ) {
					foreach ( $attribute_single_args['data'] as $single_data_key => $single_data ) {
						$wp_insert_term	=	 wp_insert_term( $single_data_key, $attribute_single_args['taxonomy'] );
						if ( !is_wp_error( $wp_insert_term ) ) {
							update_term_meta( $wp_insert_term['term_id'], '_product_attributes' . $attribute_single_args['type'], $single_data );
						}
					}
				} else {
					foreach ( $attribute_single_args['data'] as $single_data_key => $single_data ) {
						wp_insert_term( $single_data, $attribute_single_args['taxonomy'] );
					}
				}
			}
		}
		// Attribute Creation Code ENDs
	        /*--------------------------Trending Product -----------------------------*/
	            // Background Color
	            set_theme_mod( 'vw_book_store_pro_trending_product_bgcolor', '#f7f7f7' );
	            // heading
	            set_theme_mod( 'vw_book_store_pro_product_title', 'TRENDING BOOKS' );
	            // Button Text
	            set_theme_mod( 'vw_book_store_pro_trending_product_btn', 'View All' );
	              set_theme_mod( 'vw_book_store_pro_trending_product_btn_link', home_url( '/index.php/product-category/trending-books/' ),);
	            // heading
	            set_theme_mod( 'vw_book_store_pro_trending_product_btn_icon', 'fas fa-long-arrow-alt-right' );
	            // Product Count
	            set_theme_mod( 'vw_book_store_pro_trending_product_number', '8' );
	            wp_insert_term(
		            'Trending Books', // the term 
		            'product_cat', // the taxonomy
		            array(
			            'description'=> 'This is Trending Books Category',
			            'slug' => 'trending-books',
			            'term_id'=>12,
			            'term_taxonomy_id'=>34,
            		)
	            );
	            $product_name = array('As A Man Thinketh','Throne Glass','English Grammer','The Darkest Minds','Adventures Of Tintin','Percy Jackson ','The Asylum Series','Six Of Rows');
	            $review_text = array('Nice product','Nice Product','Nice Product','Nice Product','Nice Product',);
	            $_product_image_gallery = array();
		        $_product_ids = array();
	           	for($i=1;$i<=8;$i++){
		            $title = $product_name[$i-1];
		            $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
		                        // Create post object
		            $my_post = array(
			            'post_title'    => wp_strip_all_tags( $title ),
			            'post_content'  => $content,
			            'post_status'   => 'publish',
			            'post_type'     => 'product',
		            );
		            set_theme_mod( 'vw_book_store_pro_trending_products_category', 'trending-books' );
		            // Insert the post into the database
		            $post_id = wp_insert_post( $my_post );
		              for ( $c=0; $c <= 4; $c++ ) {
				    $comment_id = wp_insert_comment( array(
					'comment_post_ID'      =>  $post_id,
					'comment_author'       => get_the_author_meta( 'display_name' ),
					'comment_author_email' => get_the_author_meta( 'user_email' ),
					'comment_content'      => $review_text[$c],
					'comment_parent'       => 0,
					'user_id'              => get_current_user_id(), // <== Important
					'comment_date'         => date('Y-m-d H:i:s'),
					'comment_approved'     => 1,
				) );

				update_comment_meta( $comment_id, 'rating', 5 );
			}
		             array_push( $_product_ids, $post_id );
		            // Gets term object from Tree in the database. 
		            $term = get_term_by('name', 'Trending Books', 'product_cat');
		            wp_set_object_terms($post_id, $term->term_id, 'product_cat');
		            
		            update_post_meta( $post_id, '_regular_price', "30" );
		            update_post_meta( $post_id, '_sale_price', "25" );
		            update_post_meta( $post_id, '_price', "25" );

		            $image_url = get_template_directory_uri().'/assets/images/products/product'.$i.'.jpg';

		            $image_name= 'product'.$i.'.jpg';
		            $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
		            file_put_contents( $file, $image_data );

		            // 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 );
		             // $wp_get_attachment_url = wp_get_attachment_url( $attach_id );
			        if ( count( $_product_image_gallery ) < 3 ) {
				   array_push( $_product_image_gallery, $attach_id );
			      }

		            // And finally assign featured image to post
		            set_post_thumbnail( $post_id, $attach_id );
		        }
		    // Add Gallery in first simple product and second variable product START
		$_product_image_gallery = implode( ',', $_product_image_gallery );
		foreach ( $_product_ids as $_product_id ) {
			update_post_meta( $_product_id, '_product_image_gallery', $_product_image_gallery );
		}
		// Add Gallery in first simple product and second variable product END


		// Variable Product Creation STARTS
		$post_id		=	$_product_ids[0];
		wp_set_object_terms( $post_id, 'variable', 'product_type' );

		if ( class_exists( 'WC_Meta_Box_Product_Data' ) && class_exists( 'WC_Product_Factory' ) ) {

			// Attribute Creation in new pattern
			$attribute_taxonomies = wc_get_attribute_taxonomies();
			$attributes_data_to_insert	=	array();
			$index = 0;
			foreach ( $attribute_taxonomies as $key => $attribute_taxonomy ) {

				$taxonomy_name	=	'pa_' . $attribute_taxonomy->attribute_name;
				$terms_by_taxonomy_name = get_terms( array(
					'taxonomy' 		=> 	$taxonomy_name,
					'hide_empty'	=> false
				) );
				if ( empty( $terms_by_taxonomy_name ) ) {
					continue;
				}

				$attributes_data_to_insert['attribute_names'][]				=	$taxonomy_name;
				$attributes_data_to_insert['attribute_position'][]		=	$index;
				foreach ( $terms_by_taxonomy_name as $term_by_taxonomy_name ) {
					$attributes_data_to_insert['attribute_values'][$index][]			=	$term_by_taxonomy_name->term_id;
				}
				$attributes_data_to_insert['attribute_visibility'][]	=	1;
				$attributes_data_to_insert['attribute_variation'][]		=	1;
				++$index;
			}

			$attributes   = WC_Meta_Box_Product_Data::prepare_attributes( $attributes_data_to_insert );
			$product_id 	= $post_id;
			$product_type	=	'variable';
			$classname    = WC_Product_Factory::get_product_classname( $product_id, $product_type );
			$product      = new $classname( $product_id );
			$product->set_attributes( $attributes );
			$product->save();
			// Attribute Creation in new pattern ends here

			// new product variation creation code.
			$product    = wc_get_product( $post_id );
			$data_store = $product->get_data_store();
			$data_store->create_all_product_variations( $product, 50 );
			$data_store->sort_all_product_variations( $product->get_id() );


			$product    = wc_get_product( $post_id );
			foreach( $product->get_children() as $variation_id ) {
				// 1. Updating the stock quantity
				update_post_meta( $variation_id, '_stock', 10 );
				// 2. Updating the stock quantity
				update_post_meta( $variation_id, '_stock_status', wc_clean( 'instock' ) );
				// 3. Updating post term relationship
				wp_set_post_terms( $variation_id, 'instock', 'product_visibility', true );
				// And finally (optionally if needed)

				// Updating active price and regular price
				update_post_meta( $variation_id, '_regular_price', '2' );
				update_post_meta( $variation_id, '_sale_price', "1" );
				update_post_meta( $variation_id, '_price', '1' );
				wc_delete_product_transients( $variation_id ); // Clear/refresh the variation cache
			}
			// Clear/refresh the variable product cache
			wc_delete_product_transients( $post_id );
			// Update the prices for all the variations ends here
		}
		// Variable Product Creation ENDS


	         /*--------------------------Latest Collection -----------------------------*/
	            set_theme_mod( 'vw_book_store_pro_latest_collection_bgcolor', '#f7f7f7' );
	            set_theme_mod( 'vw_book_store_pro_latest_collection_title', 'Latest Collection' );
	            set_theme_mod( 'vw_book_store_pro_latest_collection_sale', 'Save up to 30%' );
	            set_theme_mod( 'vw_book_store_pro_latest_collection_desc', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. ' );
	            set_theme_mod( 'vw_book_store_pro_latest_collection_btn', 'View More' );
	            set_theme_mod( 'vw_book_store_pro_latest_collection_btn_url', '#' );
	            wp_insert_term(
	               'Latest Collection', // the term 
	               'product_cat', // the taxonomy
	               array(
	               'description'=> 'This is Latest Collection Category',
	               'slug' => 'latest-collection',
	               'term_id'=>14,
	               'term_taxonomy_id'=>36
	               )
	            );
	            set_theme_mod( 'vw_book_store_pro_latest_collection_category', 'latest-collection' );
	             $_product_image_gallery = array();
		         $_product_ids = array();
	            for($i=1;$i<=4;$i++){
	               $title = 'Latest Product'.$i;
	               $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
	               // Create post object
	               $my_post = array(
		               'post_title'    => wp_strip_all_tags( $title ),
		               'post_content'  => $content,
		               'post_status'   => 'publish',
		               'post_type'     => 'product'
	               );
	               // Insert the post into the database
	               $post_id = wp_insert_post( $my_post );
	               array_push( $_product_ids, $post_id );
	               // Gets term object from Tree in the database. 
	               $term = get_term_by('name', 'Latest Collection', 'product_cat');
	               wp_set_object_terms($post_id, $term->term_id, 'product_cat');
	               
	               update_post_meta( $post_id, '_regular_price', "30" );
	               update_post_meta( $post_id, '_sale_price', "25" );
	               update_post_meta( $post_id, '_price', "25" );

	               $image_url = get_template_directory_uri().'/assets/images/latest-product/latest-product'.$i.'.png';

	               $image_name= 'latest-product'.$i.'.jpg';
	               $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
	               file_put_contents( $file, $image_data );

	               // 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 );
	                // $wp_get_attachment_url = wp_get_attachment_url( $attach_id );
			    if ( count( $_product_image_gallery ) < 3 ) {
				array_push( $_product_image_gallery, $attach_id );
			}

	               // And finally assign featured image to post
	               set_post_thumbnail( $post_id, $attach_id );
	            }
	             // Add Gallery in first simple product and second variable product START
		$_product_image_gallery = implode( ',', $_product_image_gallery );
		foreach ( $_product_ids as $_product_id ) {
			update_post_meta( $_product_id, '_product_image_gallery', $_product_image_gallery );
		}
		// Add Gallery in first simple product and second variable product END

	         /*customizer-custom-variables.php*/
	         //Typography Section-First Highlight Color
	         set_theme_mod( 'vw_book_store_pro_hi_first_color', '#f06845' );
	         //Typography Section-Second Highlight Color
	         set_theme_mod( 'vw_book_store_pro_hi_scnd_color', '#f06845' );

	         /* customizer-part-header.php */
	         /*My Account*/
	         set_theme_mod( 'vw_book_store_pro_header_link1', 'My Account' );
	         /* Log Out */
	         set_theme_mod( 'vw_book_store_pro_header_link2', 'Log Out' );
	         /* Log Out */
	         set_theme_mod( 'vw_book_store_pro_header_link3', 'Help' );
	         /* Call Number */
	         set_theme_mod( 'vw_book_store_pro_header_email_address', 'bookstore@gmail.com' );

	         /* Header Widgets Category text */
	         set_theme_mod( 'vw_book_store_pro_header_cat_text', 'All Categories' );

	         /*customizer-part-slide.php*/
	         //Number of slides to show section
	         set_theme_mod( 'vw_book_store_pro_slide_number', '3' );

	         set_theme_mod( 'vw_book_store_pro_slide_delay', '10000' );
	         //Slider Images section
	        for($i=1; $i<=3; $i++) {
	            set_theme_mod( 'vw_book_store_pro_slide_image'.$i, get_template_directory_uri().'/assets/images/slides/slide'.$i.'.jpg' );
	            //Slide Sub Heading section
	            set_theme_mod( 'vw_book_store_pro_slide_sub_heading'.$i, 'Welcome To Book Store' );
	            //Slide Heading Title section
	            set_theme_mod( 'vw_book_store_pro_slide_heading'.$i, 'We Can Help Get Your Books In Order' );
	            //Slide Text section
	            set_theme_mod( 'vw_book_store_pro_slide_text'.$i, 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys.' );
	            //Slider Button Text section
	             set_theme_mod( 'vw_book_store_pro_slide_btnurl'.$i, home_url( '/index.php/shop/' ),);
	            set_theme_mod( 'vw_book_store_pro_slide_btntext'.$i, 'Shop Now' );
	        }
	   
	         /*customizer-part-home.php*/
	         //Site Services section
	            set_theme_mod( 'vw_book_store_pro_services_icon_box_number', '4' ); 
	            $services_icon = array('fas fa-shipping-fast','fas fa-money-check-alt','fas fa-dollar-sign','fas fa-headset');
	            $services_text = array('Free shipping item','Money back guarantee','Cash on delivery ','7/24 Support ');
	            $services_sub = array('For all orders over $500','100% money back guarante','Lorem ipsum dolor consectetur','Lorem ipsum dolor consectetur');
	            for($i=1; $i<=4; $i++){
	                  //Box Icon
	                  set_theme_mod( 'vw_book_store_pro_services_icon'.$i, $services_icon[$i-1] ); 
	                  //Description
	                  set_theme_mod( 'vw_book_store_pro_services_title'.$i, $services_text[$i-1] );
	                  //Description
	                  set_theme_mod( 'vw_book_store_pro_services_sub_title'.$i, $services_sub[$i-1] ); 
	            }

	         //Author Section 
	         //Section Title
	            set_theme_mod( 'vw_book_store_pro_author_color', '#cbe9e2' ); 
	            set_theme_mod( 'vw_book_store_pro_author_title', 'OUR AUTHOR' ); 
			  	   set_theme_mod( 'vw_book_store_pro_our_author_bgimage', get_template_directory_uri().'/assets/images/authorsbg.jpg');

	         //Pricing Plans 
	            //Title
	            set_theme_mod( 'vw_book_store_pro_pricing_box_section_title', 'Plans and Pricing' );
	            //background image
	            set_theme_mod( 'vw_book_store_pro_plans_pricing_bgimage', get_template_directory_uri().'/assets/images/pricebg.jpg');
	            //Number of Pricing to show section
	            set_theme_mod( 'vw_book_store_pro_pricing_box_number', '3' );
	            //counter image
	            for($i=1; $i<=4; $i++){
	                  //
	                  set_theme_mod( 'vw_book_store_pro_pricing_box_title'.$i, 'Personal' );
	                  //
	                  set_theme_mod( 'vw_book_store_pro_pricing_box_subtitle'.$i, 'The Standard Version' );
	                  //
	                  set_theme_mod( 'vw_book_store_pro_pricing_box_price'.$i, '$50' );
	                  //
	                  set_theme_mod( 'vw_book_store_pro_pricing_box_price_base'.$i, 'MON' );
	                 
	                  for($k=1; $k<=6; $k++){
	                        //
	                        set_theme_mod( 'vw_book_store_pro_plan_box_text'.$k.$i, 'Pricing Plans' );
	                        //
	                        set_theme_mod( 'vw_book_store_pro_plan_box_text_price'.$k.$i, '$25' );
	                  }
	                  //
	                  set_theme_mod( 'vw_book_store_pro_pricing_box_btn'.$i, 'Read More' );
	            }

	         //Testimonial Section
	         //Section Title
	         //Title Icon Image
	         set_theme_mod( 'vw_book_store_pro_our_testimonial_bgimage', get_template_directory_uri().'/assets/images/testimonialbg.jpg' );
	         set_theme_mod( 'vw_book_store_pro_testimonial_title', 'HAPPY CLIENT' ); 

	         //Latest Post
	         //Section Title
	            set_theme_mod( 'vw_book_store_pro_latest_post_color', '#f7f7f7' ); 
	         //Section Title
	            set_theme_mod( 'vw_book_store_pro_latestpost_title', 'OUR BOOK NEWS' );
	         //button
	            set_theme_mod( 'vw_book_store_pro_latestpost_btn', 'View All' );
	            set_theme_mod( 'vw_book_store_pro_latestpost_btn_link', home_url( '/index.php/blog/' ),);
	            set_theme_mod( 'vw_book_store_pro_latestpost_btn_icon', 'fas fa-long-arrow-alt-right' );
	         //Section Title
	            set_theme_mod( 'vw_book_store_pro_latestpost_readmore', 'Read More' ); 

	         //Our Records section 
	            //background image
	            set_theme_mod( 'vw_book_store_pro_our_records_bg_image', get_template_directory_uri().'/assets/images/recordsbg.jpg');
	            //Number of counter to show section
	            set_theme_mod( 'vw_book_store_pro_our_records_number', '4' );
	            //counter image
	            for($i=1; $i<=5; $i++){
	                  set_theme_mod( 'vw_book_store_pro_counter_bgimage'.$i, get_template_directory_uri().'/assets/images/counter/counterbg'.$i.'.jpg' );
	                  set_theme_mod( 'vw_book_store_pro_our_records_image'.$i, get_template_directory_uri().'/assets/images/counter/counter'.$i.'.png' );
	                  //counter Number
	                  set_theme_mod( 'vw_book_store_pro_number_title1'.$i, '999%' );
	                  //Counter Title
	                  set_theme_mod( 'vw_book_store_pro_circle_content1'.$i, 'Counter Text Here' );
	            }

	            //Best Seller
	               set_theme_mod( 'vw_book_store_pro_best_seller_bgcolor', '#f7f7f7' ); 
	               set_theme_mod( 'vw_book_store_pro_best_seller_title', 'BEST SELLER' );

	               set_theme_mod( 'vw_book_store_pro_best_seller_btn', 'View All' );
	               set_theme_mod( 'vw_book_store_pro_best_seller_btn_link', home_url( '/index.php/shop/' ),);

	               set_theme_mod( 'vw_book_store_pro_best_seller_btn_icon', 'fas fa-long-arrow-alt-right' );

	               //Number of counter to show section
	               set_theme_mod( 'vw_book_store_pro_tab_number', '5' );
	               $tab_title = array('Adventure','Text','komiks','Business','Music');
	               for($i=1; $i<=3; $i++){
	                  set_theme_mod( 'vw_book_store_pro_slideproduct_tab1title'.$i, $tab_title[$i-1] );
	               }
	               set_theme_mod( 'vw_book_store_pro_cate_tab1', 'trending-books' );
	               set_theme_mod( 'vw_book_store_pro_cate_tab2', 'latest-collection' );
	               set_theme_mod( 'vw_book_store_pro_cate_tab3', 'trending-books' );
	               set_theme_mod( 'vw_book_store_pro_cate_tab4', 'latest-collection' );
	               set_theme_mod( 'vw_book_store_pro_cate_tab5', 'trending-books' );

	            //Our Partners bg color
	            set_theme_mod( 'vw_book_store_pro_our_partnersbg_color', '#f7f7f7' );
	            //Our Partners Title
	            set_theme_mod( 'vw_book_store_pro_our_partner_title', 'OUR SPONSORS' ); 
	            //Number of boxes to show
	            set_theme_mod( 'vw_book_store_pro_our_partners_number', '5' ); 
	            //vw_book_store_pro_our_partners_image
	            for($i=1; $i<=6; $i++) {
	                  set_theme_mod( 'vw_book_store_pro_our_partners_image'.$i, get_template_directory_uri().'/assets/images/partners/partner'.$i.'.png' );
	            }


	         /*customizer-part-social-icons.php*/
	         //twitter link
	         set_theme_mod( 'vw_book_store_pro_headertwitter', 'https://twitter.com/' ); 
	         //facebook link 
	         set_theme_mod( 'vw_book_store_pro_headerfacebook', 'https://www.facebook.com/' ); 
	         //Linkedin link
	         set_theme_mod( 'vw_book_store_pro_headerlinkedin', 'https://www.linkedin.com' ); 
	         //GooglePlus link
	         set_theme_mod( 'vw_book_store_pro_headergoogleplus', 'https://plus.google.com/' ); 

	         /*customizer-part-footer.php*/
	         //Background image
	         set_theme_mod( 'vw_book_store_pro_section_footer_bgcolor', '#1a1616' ); 
	         //Footer section
	         set_theme_mod( 'vw_book_store_pro_footer_paycard', get_template_directory_uri().'/assets/images/footerlogo.png' );

	         set_theme_mod( 'vw_book_store_pro_footer_contact_address_icon', 'fas fa-map-marker-alt' );
	         set_theme_mod( 'vw_book_store_pro_footer_contact_address', 'Lorem Ipsum is simply dummy text of the printing and typesetting.' );
	         set_theme_mod( 'vw_book_store_pro_footer_mobile_icon', 'fas fa-phone-volume' );
	         set_theme_mod( 'vw_book_store_pro_footer_mobile1', '12345-678-89' );
	         set_theme_mod( 'vw_book_store_pro_footer_mobile2', '1234-4567-65' );
	         set_theme_mod( 'vw_book_store_pro_footer_email1_icon', 'far fa-envelope' );
	         set_theme_mod( 'vw_book_store_pro_footer_email1', 'vwbookstore@gmail.com' );
	         set_theme_mod( 'vw_book_store_pro_footer_email2', 'vwbookstorepro@gmail.com' );

	         //Contact Page
	         //Longitude
	         set_theme_mod( 'vw_book_store_pro_address_longitude', '-80.053361' ); 
	         //Latitude
	         set_theme_mod( 'vw_book_store_pro_address_latitude', '26.704241' ); 
	         //Email Title text
	         set_theme_mod( 'vw_book_store_pro_contactpage_email_title', 'Email ' ); 
	         //Email ID
	         set_theme_mod( 'vw_book_store_pro_contactpage_email', 'startup@gmail.com' ); 
	         //Address Title text
	         set_theme_mod( 'vw_book_store_pro_address_title', 'Address' ); 
	         //Address
	         set_theme_mod( 'vw_book_store_pro_address', '455 Martinson, Los Angeles' ); 
	         //Phone Title text
	         set_theme_mod( 'vw_book_store_pro_contactpage_phone_title', 'Phone' ); 
	         //Phone No.
	         set_theme_mod( 'vw_book_store_pro_contactpage_phone', '123-456-7890' );

	         //Working Hours Title
	         set_theme_mod( 'vw_book_store_pro_contactpage_working_hours_title', 'Working Hours' ); 
	         //Phone No.
	         set_theme_mod( 'vw_book_store_pro_contactpage_working_hours', 'Monday-Friday, 8am – 6pm' ); 

	         //Contact From Title
	         set_theme_mod( 'vw_book_store_pro_contactpage_form_title', 'SAY HELLO!' ); 
	         //Phone No.
	         set_theme_mod( 'vw_book_store_pro_contactpage_form_subtitle', 'We would love to hear from you!' );  

	         //footer text
	         //Copyright Text
	         set_theme_mod( 'vw_book_store_pro_footer_copy', 'Book Store Wordpress Theme 2021 | All Rights Reserved.' );
	            
	         /*--- Latest Post---*/
	        for($i=1;$i<=15;$i++){
	            $title = 'Praesent suscipit m'.$i;
	            $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, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
	            	// 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().'/assets/images/blog/blog'.$i.'.png';

	            $image_name       = 'news'.$i.'.jpg';
	            $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
	            file_put_contents( $file, $image_data );

	            // 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 );
			}
	        	
	         /*---Portfolio ---*/ 
	        for($i=1;$i<=6;$i++){
	            $title = 'Portfolio'.$i;
	            $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, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';

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

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

	            $image_url = get_template_directory_uri().'/assets/images/portfolio/portfolio'.$i.'.jpg';

	            $image_name       = 'portfolio'.$i.'.jpg';
	            $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
	            file_put_contents( $file, $image_data );

	            // 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'     => 'portfolio',
	              '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 );
	        }

	        	/*--- Testimonial---*/
	        for($i=1;$i<=4;$i++){
	            $title = 'Testimonial'.$i;
	            $content = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s';
	            	// Create post object
	            $my_post = array(
	            'post_title'    => wp_strip_all_tags( $title ),
	            'post_content'  => $content,
	            'post_status'   => 'publish',
	            'post_type'     => 'testimonials',
	            );

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

	            	// Now replafile_urice meta w/ new updated value array
	            	update_post_meta( $post_id, 'vw_book_store_pro_posttype_testimonial_desigstory', 'Designation');

	            $image_url = get_template_directory_uri().'/assets/images/testimonials/testimonial'.$i.'.png';

	            $image_name       = 'testimonial'.$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
	            file_put_contents( $file, $image_data );

	            // 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'     => 'testimonials',
	              '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 );
			}

	        	/*---Author Post ---*/ 
	        	$author_name = array('MARTINA DEO','CHRIS MARTIN','JOHN DEO','RIYA RONALDO');
	        	$author_desig = array('4 Published Book','6 Published Book','5 Published Book','4 Published Book');
	        for($i=1;$i<=4;$i++){
	         	$title = $author_name[$i-1];
	         	$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, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';

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

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

	         	// Now replace meta w/ new updated value array
	           	update_post_meta( $post_id, 'meta-desig', 'author@gmail.com');
	           	update_post_meta( $post_id, 'meta-call', '123-456-789');
	           	update_post_meta( $post_id, 'meta-facebookurl', 'https://www.facebook.com/');
	           	update_post_meta( $post_id, 'meta-linkdenurl', 'https://www.linkedin.com');
	           	update_post_meta( $post_id, 'meta-twitterurl', 'https://twitter.com/');
	           	update_post_meta( $post_id, 'meta-googleplusurl', 'https://plus.google.com' );
	           	update_post_meta( $post_id, 'meta-designation', $author_desig[$i-1]);

	           	$image_url = get_template_directory_uri().'/assets/images/author/author'.$i.'.jpg';

	            $image_name       = 'team'.$i.'.jpg';
	            $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
	            file_put_contents( $file, $image_data );

	            // 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'     => 'vw_author',
	              '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 );
	        }

	         /*---------------------Product Category----------------------*/
	         set_theme_mod( 'vw_book_store_pro_category_bgimage',get_template_directory_uri().'/assets/images/categorybg.jpg' );
	         set_theme_mod( 'vw_book_store_pro_category_title', 'OUR TOP CATEGORIES' );
	         
	         // Button Text
	            set_theme_mod( 'vw_book_store_pro_category_btn', 'View All' );
	             set_theme_mod( 'vw_book_store_pro_category_btn_link', home_url( '/index.php/product-category/trending-books/' ),);
	            // heading
	            set_theme_mod( 'vw_book_store_pro_category_btn_icon', 'fas fa-long-arrow-alt-right' );
	         set_theme_mod( 'vw_book_store_pro_category_number', '5' );

	        for($i=1;$i<=5;$i++){
	            $cid = wp_insert_term(
	               'Product Category'.$i, // the term 
	               'product_cat', // the taxonomy
	               array(
	               'description'=> 'Lorem Ipsum euismod his at.',
	               'slug' => 'product-category'.$i,
	               'term_id'=>12,
	               'term_taxonomy_id'=>34,
	               )
	            );
	            set_theme_mod( 'vw_book_store_pro_product_cat'.$i, 'product-category'.$i );

	            $image_url = get_template_directory_uri().'/assets/images/categories/category'.$i.'.jpg';

	            $image_name= 'category'.$i.'.jpg';
	            $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
	            file_put_contents( $file, $image_data );

	            // 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 );

	            update_woocommerce_term_meta( $cid['term_id'], 'thumbnail_id', $attach_id );
	        }
        // categories

	          if ( class_exists( 'WooCommerce' ) ) {

	 			wp_insert_term(
		            'Product Category1', // the term 
		            'product_cat', // the taxonomy
		            array(
			            'description'=> 'This is Product Category1',
			            'slug' => 'product-category1',
			            'term_id'=>12,
			            'term_taxonomy_id'=>34,
            		)
	        	);
                    $product_name = array('Software Engineering','Ikigai: Japanese Secret','The Secret','The Fashion Designer','Rise Of Earth Dragon','Marketing Management ','News Best Book','Book Bloggers');
	        	  	for($i=1;$i<=8;$i++){
		            $title = $product_name[$i-1];
		            $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
		                        // Create post object
		            $my_post = array(
			            'post_title'    => wp_strip_all_tags( $title ),
			            'post_content'  => $content,
			            'post_status'   => 'publish',
			            'post_type'     => 'product',
		            );
		            set_theme_mod( 'vw_book_store_pro_product_cat', 'product-category1' );
		            // Insert the post into the database
		            $post_id = wp_insert_post( $my_post );
		            // Gets term object from Tree in the database. 
		            $term = get_term_by('name', 'Product Category1', 'product_cat');
		            wp_set_object_terms($post_id, $term->term_id, 'product_cat');
		            
		            update_post_meta( $post_id, '_regular_price', "30" );
		            update_post_meta( $post_id, '_sale_price', "25" );
		            update_post_meta( $post_id, '_price', "25" );

		            $image_url = get_template_directory_uri().'/assets/images/products/product'.$i.'.jpg';

		            $image_name= 'product'.$i.'.jpg';
		            $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
		            file_put_contents( $file, $image_data );

		            // 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 );
		        }



	 }
	 // Add Gallery in first simple product and second variable product START
		$_product_image_gallery = implode( ',', $_product_image_gallery );
		foreach ( $_product_ids as $_product_id ) {
			update_post_meta( $_product_id, '_product_image_gallery', $_product_image_gallery );
		}
		// Add Gallery in first simple product and second variable product END


	        
	  if ( class_exists( 'WooCommerce' ) ) {

	 			wp_insert_term(
		            'Product Category2', // the term 
		            'product_cat', // the taxonomy
		            array(
			            'description'=> 'This is Product Category2',
			            'slug' => 'product-category2',
			            'term_id'=>12,
			            'term_taxonomy_id'=>34,
            		)
	        	);
                    $product_name = array('Software Engineering','Ikigai: Japanese Secret','The Secret','The Fashion Designer','Rise Of Earth Dragon','Marketing Management ','News Best Book','Book Bloggers');
	        	  	for($i=1;$i<=8;$i++){
		            $title = $product_name[$i-1];
		            $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
		                        // Create post object
		            $my_post = array(
			            'post_title'    => wp_strip_all_tags( $title ),
			            'post_content'  => $content,
			            'post_status'   => 'publish',
			            'post_type'     => 'product',
		            );
		            set_theme_mod( 'vw_book_store_pro_product_cat', 'product-category2' );
		            // Insert the post into the database
		            $post_id = wp_insert_post( $my_post );
		            // Gets term object from Tree in the database. 
		            $term = get_term_by('name', 'Product Category2', 'product_cat');
		            wp_set_object_terms($post_id, $term->term_id, 'product_cat');
		            
		            update_post_meta( $post_id, '_regular_price', "30" );
		            update_post_meta( $post_id, '_sale_price', "25" );
		            update_post_meta( $post_id, '_price', "25" );

		            $image_url = get_template_directory_uri().'/assets/images/products/product'.$i.'.jpg';

		            $image_name= 'product'.$i.'.jpg';
		            $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
		            file_put_contents( $file, $image_data );

		            // 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 );
		        }



	 }
	 // Add Gallery in first simple product and second variable product START
		$_product_image_gallery = implode( ',', $_product_image_gallery );
		foreach ( $_product_ids as $_product_id ) {
			update_post_meta( $_product_id, '_product_image_gallery', $_product_image_gallery );
		}
		// Add Gallery in first simple product and second variable product END

if ( class_exists( 'WooCommerce' ) ) {

	 			wp_insert_term(
		            'Product Category3', // the term 
		            'product_cat', // the taxonomy
		            array(
			            'description'=> 'This is Product Category3',
			            'slug' => 'product-category3',
			            'term_id'=>12,
			            'term_taxonomy_id'=>34,
            		)
	        	);
                    $product_name = array('Software Engineering','Ikigai: Japanese Secret','The Secret','The Fashion Designer','Rise Of Earth Dragon','Marketing Management ','News Best Book','Book Bloggers');
	              for($i=1;$i<=8;$i++){
		            $title = $product_name[$i-1];
		            $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
		                        // Create post object
		            $my_post = array(
			            'post_title'    => wp_strip_all_tags( $title ),
			            'post_content'  => $content,
			            'post_status'   => 'publish',
			            'post_type'     => 'product',
		            );
		            set_theme_mod( 'vw_book_store_pro_product_cat', 'product-category3' );
		            // Insert the post into the database
		            $post_id = wp_insert_post( $my_post );
		            // Gets term object from Tree in the database. 
		            $term = get_term_by('name', 'Product Category3', 'product_cat');
		            wp_set_object_terms($post_id, $term->term_id, 'product_cat');
		            
		            update_post_meta( $post_id, '_regular_price', "30" );
		            update_post_meta( $post_id, '_sale_price', "25" );
		            update_post_meta( $post_id, '_price', "25" );

		            $image_url = get_template_directory_uri().'/assets/images/products/product'.$i.'.jpg';

		            $image_name= 'product'.$i.'.jpg';
		            $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
		            file_put_contents( $file, $image_data );

		            // 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 );
		        }



	 }
	 // Add Gallery in first simple product and second variable product START
		$_product_image_gallery = implode( ',', $_product_image_gallery );
		foreach ( $_product_ids as $_product_id ) {
			update_post_meta( $_product_id, '_product_image_gallery', $_product_image_gallery );
		}
		// Add Gallery in first simple product and second variable product END

if ( class_exists( 'WooCommerce' ) ) {

	 			wp_insert_term(
		            'Product Category4', // the term 
		            'product_cat', // the taxonomy
		            array(
			            'description'=> 'This is Product Category4',
			            'slug' => 'product-category4',
			            'term_id'=>12,
			            'term_taxonomy_id'=>34,
            		)
	        	);
                    $product_name = array('Software Engineering','Ikigai: Japanese Secret','The Secret','The Fashion Designer','Rise Of Earth Dragon','Marketing Management ','News Best Book','Book Bloggers');
	              for($i=1;$i<=8;$i++){
		            $title = $product_name[$i-1];
		            $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
		                        // Create post object
		            $my_post = array(
			            'post_title'    => wp_strip_all_tags( $title ),
			            'post_content'  => $content,
			            'post_status'   => 'publish',
			            'post_type'     => 'product',
		            );
		            set_theme_mod( 'vw_book_store_pro_product_cat', 'product-category4' );
		            // Insert the post into the database
		            $post_id = wp_insert_post( $my_post );
		            // Gets term object from Tree in the database. 
		            $term = get_term_by('name', 'Product Category4', 'product_cat');
		            wp_set_object_terms($post_id, $term->term_id, 'product_cat');
		            
		            update_post_meta( $post_id, '_regular_price', "30" );
		            update_post_meta( $post_id, '_sale_price', "25" );
		            update_post_meta( $post_id, '_price', "25" );

		            $image_url = get_template_directory_uri().'/assets/images/products/product'.$i.'.jpg';

		            $image_name= 'product'.$i.'.jpg';
		            $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
		            file_put_contents( $file, $image_data );

		            // 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 );
		        }



	 }
	 // Add Gallery in first simple product and second variable product START
		$_product_image_gallery = implode( ',', $_product_image_gallery );
		foreach ( $_product_ids as $_product_id ) {
			update_post_meta( $_product_id, '_product_image_gallery', $_product_image_gallery );
		}
		// Add Gallery in first simple product and second variable product END


		if ( class_exists( 'WooCommerce' ) ) {

	 			wp_insert_term(
		            'Product Category5', // the term 
		            'product_cat', // the taxonomy
		            array(
			            'description'=> 'This is Product Category5',
			            'slug' => 'product-category5',
			            'term_id'=>12,
			            'term_taxonomy_id'=>34,
            		)
	        	);
                    $product_name = array('Software Engineering','Ikigai: Japanese Secret','The Secret','The Fashion Designer','Rise Of Earth Dragon','Marketing Management ','News Best Book','Book Bloggers');
	              for($i=1;$i<=8;$i++){
		            $title = $product_name[$i-1];
		            $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
		                        // Create post object
		            $my_post = array(
			            'post_title'    => wp_strip_all_tags( $title ),
			            'post_content'  => $content,
			            'post_status'   => 'publish',
			            'post_type'     => 'product',
		            );
		            set_theme_mod( 'vw_book_store_pro_product_cat', 'product-category5' );
		            // Insert the post into the database
		            $post_id = wp_insert_post( $my_post );
		            // Gets term object from Tree in the database. 
		            $term = get_term_by('name', 'Product Category5', 'product_cat');
		            wp_set_object_terms($post_id, $term->term_id, 'product_cat');
		            
		            update_post_meta( $post_id, '_regular_price', "30" );
		            update_post_meta( $post_id, '_sale_price', "25" );
		            update_post_meta( $post_id, '_price', "25" );

		            $image_url = get_template_directory_uri().'/assets/images/products/product'.$i.'.jpg';

		            $image_name= 'product'.$i.'.jpg';
		            $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
		            file_put_contents( $file, $image_data );

		            // 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 );
		        }



	 }
	 // Add Gallery in first simple product and second variable product START
		$_product_image_gallery = implode( ',', $_product_image_gallery );
		foreach ( $_product_ids as $_product_id ) {
			update_post_meta( $_product_id, '_product_image_gallery', $_product_image_gallery );
		}
		// Add Gallery in first simple product and second variable product END




		
	         //post setting
	        set_theme_mod( 'vw_book_store_pro_related_posts_title', 'Related Posts' );
	        set_theme_mod( 'vw_book_store_pro_related_post_count', 3 );
	        set_theme_mod( 'vw_book_store_pro_blog_category_prev_title', 'Previous' );
	        set_theme_mod( 'vw_book_store_pro_blog_category_next_title', 'Next' );

	         /* --------- 404 Not Found ------------- */
             set_theme_mod( 'vw_book_store_pro_error_temp_bg_images',get_template_directory_uri().'/assets/images/404-img.png' );
	        set_theme_mod( 'vw_book_store_pro_404_page_title', '404 Not Found' );
	        set_theme_mod( 'vw_book_store_pro_404_page_content', 'Looks like you have taken a wrong turn &hellip; Don\'t worry &hellip; it happens to the best of us.' );
	        set_theme_mod( 'vw_book_store_pro_404_page_button_text', 'Back to Home Page' );
            set_theme_mod( 'vw_book_store_pro_res_open_menu_icon', 'fas fa-bars' );
	        /* ------------- Responsive Media Settings ------------ */
	        set_theme_mod( 'vw_book_store_pro_newsletter_title', 'NEWSLETTER' );
	        set_theme_mod( 'vw_book_store_pro_newsletter_subtitle', 'Lorem Ipsum is simply dummy text of the printing' );

	        // newsletter

	        set_theme_mod( 'vw_book_store_pro_header_search_icon', 'fas fa-search' );
	        set_theme_mod( 'vw_book_store_pro_res_close_menu_icon', 'fas fa-times' );


	        //faq
        set_theme_mod( 'vw_book_store_pro_faq_bg_image',get_template_directory_uri().'/assets/images/faq.png' );
          set_theme_mod( 'vw_book_store_pro_faq_number', 3 );
            
             set_theme_mod( 'vw_book_store_pro_faq_main_heading', 'Frequently Asked Questions' ); 
              set_theme_mod( 'vw_book_store_pro_faq_sub_heading', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

' ); 
              $faq_title = array("24/7 Support", "Creating Workplaces That Work","Great Change Requires Support" );
             $faq_cont = array("Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast Eros fusce nisi himenaeos fermentum nascetur netus pretium lacinia elit","Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast Eros fusce nisi himenaeos fermentum nascetur netus pretium lacinia elit","Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast Eros fusce nisi himenaeos fermentum nascetur netus pretium lacinia elit","Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast Eros fusce nisi himenaeos fermentum nascetur netus pretium lacinia elit","Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast Eros fusce nisi himenaeos fermentum nascetur netus pretium lacinia elit" );
        for($i=1; $i<=3; $i++) {
          
       set_theme_mod( 'vw_book_store_pro_faq_button'.$i, $faq_title[$i-1] );
         			set_theme_mod( 'vw_book_store_pro_faq_content'.$i, $faq_cont[$i-1]);

          } 

          // about-us
        set_theme_mod( 'vw_book_store_pro_page_img',get_template_directory_uri().'/assets/images/ABOUT-IMG.png' );
        set_theme_mod( 'vw_book_store_pro_abouts_main_head', 'ABOUT BOOKSTORE' ); 
         set_theme_mod( 'vw_book_store_pro_abouts_para', 'Lorem ipsum scelerisque molestie id molestie magna ante etiam sollicitudin tempus consectetur conubia, urna eros nunc curabitur viverra rutrum tortor luctus torquent mollis est dictum euismod.' ); 
          set_theme_mod( 'vw_book_store_pro_about_paragra1', 'We Provide a one-stop-solution for 
            establishing a performance efficient website for all books' ); 
           set_theme_mod( 'vw_book_store_pro_about_paragra2', 'We create base on a deeply analysis of your project.' ); 
            set_theme_mod( 'vw_book_store_pro_about_paragra3', 'We Provide sections cascaded to form a continuity to never leave the visitors idle.' ); 
             set_theme_mod( 'vw_book_store_pro_about_buttons', 'Learn More' ); 
              set_theme_mod( 'vw_book_store_pro_about_section_head', 'Let’s make great things together!
' ); 
               set_theme_mod( 'vw_book_store_pro_about_section_sub_heading', 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using Content here, content here, making it look like readable English.

' ); 

        set_theme_mod( 'vw_book_store_pro_about_temp_bg_image',get_template_directory_uri().'/assets/images/aboutus-bg.png' );
        set_theme_mod( 'vw_book_store_pro_about_center_bg_image',get_template_directory_uri().'/assets/images/aboutus-img.png' );
        set_theme_mod( 'vw_book_store_pro_about_temp_head', 'The Largest Bookstore ' );
        set_theme_mod( 'vw_book_store_pro_about_temp_sub_head', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.' );
        set_theme_mod( 'vw_book_store_pro_about_temp_para', 'In dui magna, posuere eget, vestibulum et, tempor auctor, justo. Vestibulum eu odio.interdum lacus sit amet orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia..' );
     
            // Our Services
        set_theme_mod( 'vw_book_store_pro_services_page_img',get_template_directory_uri().'/assets/images/Servicesimg.png' );
        set_theme_mod( 'vw_book_store_pro_services_main_head', 'OUR SERVICES' ); 
         set_theme_mod( 'vw_book_store_pro_services_para', 'Welcome to the Most Popular Book Store' ); 
          set_theme_mod( 'vw_book_store_pro_services_headings1', 'We Provide a one-stop-solution for establishing a performance.' ); 
           set_theme_mod( 'vw_book_store_pro_services_paragra1', 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.' ); 
            set_theme_mod( 'vw_book_store_pro_services_headings2', 'We create base on a deeply analysis of your project.' ); 
             set_theme_mod( 'vw_book_store_pro_services_paragra2', 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.' ); 
              set_theme_mod( 'vw_book_store_pro_services_headings3', 'We Provide sections cascaded to form a continuity.
' ); 
               set_theme_mod( 'vw_book_store_pro_services_paragra3', 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.

' ); 
	        //Scroll Top
        	set_theme_mod( 'vw_book_store_pro_genral_section_show_scroll_top_icon', 'fas fa-angle-double-up' );

        	//Skip Link
        	set_theme_mod( 'vw_book_store_pro_header_skip_link', 'Skip To Content' );


        	// Newsletter shortcode
         	$cf7title = "Newsletter";
			$cf7content = '
			[email* your-email placeholder "Your Email"]
            [submit "Subscribe"]
			[_site_title] "[your-subject]"
			[_site_title] <abc@gmail.com>
			From: [your-name] <[your-email]>
			Subject: [your-subject]

			Message Body:
			[your-message]

			--
			This e-mail was sent from a contact form on [_site_title] ([_site_url])
			[_site_admin_email]
			Reply-To: [your-email]

			0
			0

			[_site_title] "[your-subject]"
			[_site_title] <abc@gmail.com>
			Message Body:
			[your-message]

			--
			This e-mail was sent from a contact form on [_site_title] ([_site_url])
			[your-email]
			Reply-To: [_site_admin_email]

			0
			0
			Thank you for your message. It has been sent.
			There was an error trying to send your message. Please try again later.
			One or more fields have an error. Please check and try again.
			There was an error trying to send your message. Please try again later.
			You must accept the terms and conditions before sending your message.
			The field is required.
			The field is too long.
			The field is too short.
			There was an unknown error uploading the file.
			You are not allowed to upload files of this type.
			The file is too big.
			There was an error uploading the file.';

			$cf7_post = array(
			'post_title'    => wp_strip_all_tags( $cf7title ),
			'post_content'  => $cf7content,
			'post_status'   => 'publish',
			'post_type'     => 'wpcf7_contact_form',
			);
			// Insert the post into the database
			$cf7post_id = wp_insert_post( $cf7_post );

			add_post_meta($cf7post_id, "_form", '[email* your-email placeholder "Your Email"]
			[submit "Subscribe"]');

			$cf7mail_data  = array('subject' => '[_site_title] "[your-subject]"',
			    'sender' => '[_site_title] <abc@gmail.com>',
			    'body' => 'From: [your-name] <[your-email]>
			Subject: [your-subject]

			Message Body:
			[your-message]

			--
			This e-mail was sent from a contact form on [_site_title] ([_site_url])',
			    'recipient' => '[_site_admin_email]',
			    'additional_headers' => 'Reply-To: [your-email]',
			    'attachments' => '',
			    'use_html' => 0,
			    'exclude_blank' => 0 );

			add_post_meta($cf7post_id, "_mail", $cf7mail_data);
			          // Gets term object from Tree in the database.

			$cf7shortcode = '[contact-form-7 id="'.$cf7post_id.'" title="'.$cf7title.'"]';

			set_theme_mod( 'vw_book_store_pro_newsletter_shortcode',$cf7shortcode );

			// contact form shortcode
         	$cf7title1 = "Contact Page";
			$cf7content1 = '[text* your-name placeholder "Your Name"]

			[email* your-email placeholder "Your Email"]


			[text* your-subject placeholder "Your Subject"]

			[textarea your-message placeholder "Your Messsage"]

			[submit "Subscribe"]
			[_site_title] "[your-subject]"
			[_site_title] <abc@gmail.com>
			From: [your-name] <[your-email]>
			Subject: [your-subject]

			Message Body:
			[your-message]

			--
			This e-mail was sent from a contact form on [_site_title] ([_site_url])
			[_site_admin_email]
			Reply-To: [your-email]

			0
			0

			[_site_title] "[your-subject]"
			[_site_title] <abc@gmail.com>
			Message Body:
			[your-message]

			--
			This e-mail was sent from a contact form on [_site_title] ([_site_url])
			[your-email]
			Reply-To: [_site_admin_email]

			0
			0
			Thank you for your message. It has been sent.
			There was an error trying to send your message. Please try again later.
			One or more fields have an error. Please check and try again.
			There was an error trying to send your message. Please try again later.
			You must accept the terms and conditions before sending your message.
			The field is required.
			The field is too long.
			The field is too short.
			There was an unknown error uploading the file.
			You are not allowed to upload files of this type.
			The file is too big.
			There was an error uploading the file.';

			$cf7_post1 = array(
			'post_title'    => wp_strip_all_tags( $cf7title1 ),
			'post_content'  => $cf7content1,
			'post_status'   => 'publish',
			'post_type'     => 'wpcf7_contact_form',
			);
			// Insert the post into the database
			$cf7post_id1= wp_insert_post( $cf7_post );

			add_post_meta($cf7post_id1, "_form", '[text* your-name placeholder "Your Name"]

			[email* your-email placeholder "Your Email"]


			[text* your-subject placeholder "Your Subject"]

			[textarea your-message placeholder "Your Messsage"]

			[submit "Subscribe"]');

			$cf7mail_data1  = array('subject' => '[_site_title] "[your-subject]"',
			    'sender' => '[_site_title] <abc@gmail.com>',
			    'body' => 'From: [your-name] <[your-email]>
			Subject: [your-subject]

			Message Body:
			[your-message]

			--
			This e-mail was sent from a contact form on [_site_title] ([_site_url])',
			    'recipient' => '[_site_admin_email]',
			    'additional_headers' => 'Reply-To: [your-email]',
			    'attachments' => '',
			    'use_html' => 0,
			    'exclude_blank' => 0 );

			add_post_meta($cf7post_id1, "_mail", $cf7mail_data1);
			          // Gets term object from Tree in the database.

			$cf7shortcode1 = '[contact-form-7 id="'.$cf7post_id1.'" title="'.$cf7title1.'"]';

			set_theme_mod( 'vw_book_store_pro_contactpage_shortcode',$cf7shortcode1 );
    
    	 $this->theme_create_customizer_nav_menu();
    	  $this->theme_create_customizer_footer_nav_menu();
    	  $this->theme_create_customizer_footers_nav_menu();

	        $VW_Widget_Importer = new VW_Widget_Importer;
			$VW_Widget_Importer->import_widgets( $this->widget_file_url );
			exit;
		}


	public function wz_activate_vw_book_store_pro() {
		$vw_book_store_pro_license_key = $_POST['vw_book_store_pro_license_key'];

		$endpoint = SHOPIFY_THEME_LICENCE_ENDPOINT.'verifyTheme';

		$body = [
			'theme_license_key'  => $vw_book_store_pro_license_key,
			'site_url'					 => site_url(),
			'theme_text_domain'	 => wp_get_theme()->get( 'TextDomain' )
		];
		$body = wp_json_encode( $body );
		$options = [
			'body'        => $body,
			'headers'     => [
				'Content-Type' => 'application/json',
			]
		];
		$response = wp_remote_post( $endpoint, $options );
		if ( is_wp_error( $response ) ) {
			ThemeWhizzie::remove_the_theme_key();
			ThemeWhizzie::set_the_validation_status('false');
			$response = array('status' => false, 'msg' => 'Something Went Wrong!');
			wp_send_json($response);
			exit;
		} else {
			$response_body = wp_remote_retrieve_body( $response );
			$response_body = json_decode($response_body);

			if ( $response_body->is_suspended == 1 ) {
				ThemeWhizzie::set_the_suspension_status( 'true' );
			} else {
				ThemeWhizzie::set_the_suspension_status( 'false' );
			}

			if ($response_body->status === false) {
				ThemeWhizzie::remove_the_theme_key();
				ThemeWhizzie::set_the_validation_status('false');
				$response = array('status' => false, 'msg' => $response_body->msg);
				wp_send_json($response);
				exit;
			} else {
				ThemeWhizzie::set_the_validation_status('true');
				ThemeWhizzie::set_the_theme_key($vw_book_store_pro_license_key);
				$response = array('status' => true, 'msg' => 'Theme Activated Successfully!');
				wp_send_json($response);
				exit;
			}
		}
	}



	/**
	 * Imports Ibtana Builder Demo Content
	 * @since 1.1.0
	 */
public function setup_builder() {
		$buildercontent = '';
		$resp_slug = '';
		$json_theme = array('base_theme_text_domain' => 'vw-book-store');
	    $json_args = array(
	        'method' => 'POST',
	        'headers'     => array(
	            'Content-Type'  => 'application/json'
	        ),
	        'body' => json_encode($json_theme),
	    );

	    $request_data = wp_remote_post( IBTANA_THEME_LICENCE_ENDPOINT.'get_client_ibtana_premium_theme_json_with_inner_pages',$json_args);
	    $response_json = json_decode(wp_remote_retrieve_body( $request_data));

	    // echo '<pre>'; print_r($response_json->data); echo '</pre>';

	    
	    foreach($response_json->data as $resp_json) {
		    if($resp_json->page_type='template'){
		    	$resp_slug = $resp_json->slug ; 
		    }
	    }

		$json_theme1 = array('premium_template_slug' => $resp_slug);
	    $json_args1 = array(
	        'method' => 'POST',
	        'headers'     => array(
	            'Content-Type'  => 'application/json'
	        ),
	        'body' => json_encode($json_theme1),
	    );

	    $request_data1 = wp_remote_post( IBTANA_THEME_LICENCE_ENDPOINT.'get_client_ibtana_premium_theme_json',$json_args1);
	    $response_json1 = json_decode(wp_remote_retrieve_body( $request_data1));
/*	    print_r($response_json1->data);
*/
       	$buildercontent = $response_json1->data;
       	// Blog For loop
    /*--- Latest Post---*/
	        for($i=1;$i<=15;$i++){
	            $title = 'Praesent suscipit m'.$i;
	            $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, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
	            	// 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().'/assets/images/blog/blog'.$i.'.png';

	            $image_name       = 'news'.$i.'.jpg';
	            $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
	            file_put_contents( $file, $image_data );

	            // 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 );
			}


	 if ( class_exists( 'WooCommerce' ) ) {

	 		  wp_insert_term(
	               'Latest Collection', // the term 
	               'product_cat', // the taxonomy
	               array(
	               'description'=> 'This is Latest Collection Category',
	               'slug' => 'latest-collection',
	               'term_id'=>14,
	               'term_taxonomy_id'=>36
	               )
	            );

	 		      for($i=1;$i<=4;$i++){
	               $title = 'Latest Product'.$i;
	               $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
	               // Create post object
	               $my_post = array(
		               'post_title'    => wp_strip_all_tags( $title ),
		               'post_content'  => $content,
		               'post_status'   => 'publish',
		               'post_type'     => 'product'
	               );
	               // Insert the post into the database
	               $post_id = wp_insert_post( $my_post );
	               // Gets term object from Tree in the database. 
	               $term = get_term_by('name', 'Latest Collection', 'product_cat');
	               wp_set_object_terms($post_id, $term->term_id, 'product_cat');
	               
	               update_post_meta( $post_id, '_regular_price', "30" );
	               update_post_meta( $post_id, '_sale_price', "25" );
	               update_post_meta( $post_id, '_price', "25" );

	               $image_url = get_template_directory_uri().'/assets/images/latest-product/latest-product'.$i.'.png';

	               $image_name= 'latest-product'.$i.'.jpg';
	               $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
	               file_put_contents( $file, $image_data );

	               // 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 );
	            }


	 }

	 if ( class_exists( 'WooCommerce' ) ) {

	 			wp_insert_term(
		            'Trending Books', // the term 
		            'product_cat', // the taxonomy
		            array(
			            'description'=> 'This is Trending Books Category',
			            'slug' => 'trending-books',
			            'term_id'=>12,
			            'term_taxonomy_id'=>34,
            		)
	        	);
                    $product_name = array('Software Engineering','Ikigai: Japanese Secret','The Secret','The Fashion Designer','Rise Of Earth Dragon','Marketing Management ','News Best Book','Book Bloggers');
	        	  	for($i=1;$i<=8;$i++){
		            $title = $product_name[$i-1];
		            $content = 'Lorem Ipsum has been the industrys 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 Lorem Ipsum has been the industrys 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.';
		                        // Create post object
		            $my_post = array(
			            'post_title'    => wp_strip_all_tags( $title ),
			            'post_content'  => $content,
			            'post_status'   => 'publish',
			            'post_type'     => 'product',
		            );
		            set_theme_mod( 'vw_book_store_pro_trending_products_category', 'trending-books' );
		            // Insert the post into the database
		            $post_id = wp_insert_post( $my_post );
		            // Gets term object from Tree in the database. 
		            $term = get_term_by('name', 'Trending Books', 'product_cat');
		            wp_set_object_terms($post_id, $term->term_id, 'product_cat');
		            
		            update_post_meta( $post_id, '_regular_price', "30" );
		            update_post_meta( $post_id, '_sale_price', "25" );
		            update_post_meta( $post_id, '_price', "25" );

		            $image_url = get_template_directory_uri().'/assets/images/products/product'.$i.'.jpg';

		            $image_name= 'product'.$i.'.jpg';
		            $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
		            file_put_contents( $file, $image_data );

		            // 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 );
		        }



	 }


         
		$home_id; $blog_id=''; $contact_id=''; $page_id= '';$page_title='';
		$page_slug=''; global $home_b;

		$page_title = 'Home Page';
		$page_slug = 'home-page';

       	$page_check = get_page_by_title($page_title);
       	$vw_page = array(
       		'post_type' => 'page',
       		'post_title' => $page_title,
       		'post_content'  => $buildercontent,
       		'post_status' => 'publish',
       		'post_author' => 1,
       		'post_slug' => $page_slug
       	);
       	$home_id = wp_insert_post(wp_slash($vw_page));
       	add_post_meta( $home_id, '_wp_page_template', 'page-template/ibtana-template.php' );


		$home_b = get_page_by_title( 'Home Page' );

       	update_option( 'page_on_front', $home_b->ID );
       	update_option( 'show_on_front', 'page' );


        // Create a blog page and assigned the template
        $blog_title = 'Blog';
        $blog = array(
             'post_type' => 'page',
             'post_title' => $blog_title,
             'post_status' => 'publish',
             'post_author' => 1,
             'post_slug' => 'blog'
        );
        $blog_id = wp_insert_post($blog);


        //Set the blog page template
        add_post_meta( $blog_id, '_wp_page_template', 'page-template/blog-fullwidth-extend.php' );


        // Create a Page
        if( get_page_by_title( 'Page' ) == NULL ){
         	$page_title = 'Page ';
         	$content = 'Te obtinuit ut adepto satis somno. Aliisque institoribus iter deliciae vivet vita. Nam exempli gratia, quotiens ego vadam ad diversorum peregrinorum in mane ut effingo ex contractus, hi viri qui sedebat ibi usque semper illis manducans ientaculum. Solum cum bulla ut debui; EGO youd adepto a macula proiciendi. Sed quis scit si forte quod esset optima res pro me. sicut ea quae sentio. Qui vellem cadunt off ius desk ejus! Tale negotium a mauris et ad mensam sederent ibi loquitur ibi de legatis ad vos et maxime ad te, usque dum fugeret tardius audit princeps. Bene tamen fiduciam Ego got off semel';

         	$page_check = get_page_by_title($page_title);
        	$vw_page = array(
	         	'post_type' => 'page',
	         	'post_title' => $page_title,
	         	'post_content'  => $content,
	         	'post_status' => 'publish',
	         	'post_author' => 1,
	         	'post_slug' => 'page'
        	);
       		$page_id = wp_insert_post($vw_page);
         }

        // Create a contact page and assigned the template
        $contact_title = 'Contact';
        $contact = array(
          'post_type' => 'page',
          'post_title' => $contact_title,
          'post_status' => 'publish',
          'post_author' => 1,
          'post_slug' => 'contact'
        );
 		$contact_id = wp_insert_post($contact);

        //Set the blog with right sidebar template
        add_post_meta( $contact_id, '_wp_page_template', 'page-template/contact.php' );
        if(isset($home_b->ID)){
        	echo json_encode(['home_page_id'=>$home_b->ID,'home_page_url'=>get_edit_post_link( $home_b->ID, '' )]);
        }

       	$VW_Widget_Importer = new VW_Widget_Importer;
		$VW_Widget_Importer->import_widgets( $this->widget_file_url );

		exit;

	}


	// ------------ Ibtana Activation Close -----------
	//guidline for about theme
	public function vw_book_store_pro_mostrar_guide() {

		$display_string = '';

		// Check the validation Start
		$vw_book_store_pro_license_key = ThemeWhizzie::get_the_theme_key();
		$endpoint = SHOPIFY_THEME_LICENCE_ENDPOINT.'status';
		$body = [
			'theme_license_key'  => $vw_book_store_pro_license_key,
			'site_url'					 => site_url(),
			'theme_text_domain'	 => wp_get_theme()->get( 'TextDomain' )
		];
		$body = wp_json_encode( $body );
		$options = [
			'body'        => $body,
			'headers'     => [
				'Content-Type' => 'application/json',
			]
		];
		$response = wp_remote_post( $endpoint, $options );
		if ( is_wp_error( $response ) ) {
			// ThemeWhizzie::set_the_validation_status('false');
		} else {
			$response_body = wp_remote_retrieve_body( $response );
			$response_body = json_decode($response_body);

			if ( $response_body->is_suspended == 1 ) {
				ThemeWhizzie::set_the_suspension_status( 'true' );
			} else {
				ThemeWhizzie::set_the_suspension_status( 'false' );
			}
			
			$display_string = isset($response_body->display_string) ? $response_body->display_string : '';

			if ($display_string != '') {
				if (strpos($display_string, '[THEME_NAME]') !== false) {
					$display_string = str_replace("[THEME_NAME]", "VW Book Store Pro", $display_string);
				}
				if (strpos($display_string, '[THEME_PERMALINK]') !== false) {
					$display_string = str_replace("[THEME_PERMALINK]", "https://www.vwthemes.com/themes/bakery-wordpress-theme/", $display_string);
				}
				echo '<div class="notice is-dismissible error thb_admin_notices">' . $display_string . '</div>';
			}

			

			if ($response_body->status === false) {
				ThemeWhizzie::set_the_validation_status('false');
			} else {
				ThemeWhizzie::set_the_validation_status('true');
			}
		}
		// Check the validation END

		$theme_validation_status = ThemeWhizzie::get_the_validation_status();

		//custom function about theme customizer
		$return = add_query_arg( array()) ;
		$theme = wp_get_theme( 'vw-book-store-pro' );

		?>

		<div class="wrapper-info get-stared-page-wrap">

			<div class="wrapper-info-content">
				<h2><?php _e( 'Welcome to VW Book Store Pro', 'vw-book-store-pro' ); ?> <span class="version">Version: <?php echo esc_html($theme['Version']);?></span></h2>
				<p><?php _e('All our WordPress themes are modern, minimalist, 100% responsive, seo-friendly,feature-rich, block based and multipurpose that best suit designers, bloggers and other professionals who are working in the creative fields.','vw-book-store-pro'); ?></p>
			</div>
			<div class="tab-sec theme-option-tab">
				<div class="tab">
					<button class="tablinks active" onclick="openCity(event, 'theme_activation')" data-tab="theme_activation"><?php _e( 'Key Activation', 'vw-book-store-pro' ); ?></button>
					<button class="tablinks wizard-tab" onclick="openCity(event, 'demo_offer')" data-tab="demo_offer"><?php _e( 'Setup Wizard', 'vw-book-store-pro' ); ?></button>
					<button class="tablinks" onclick="openCity(event, 'theme_info')" data-tab="theme_info"><?php _e( 'Support', 'vw-book-store-pro' ); ?></button>
					<button class="tablinks" onclick="openCity(event, 'plugins')" data-tab="plugins"><?php _e( 'Plugins', 'vw-book-store-pro' ); ?></button>
					<button class="tablinks other-product-tab" onclick="openCity(event, 'others_theme')"><?php esc_html_e( 'All Themes', 'vw-book-store-pro' ); ?></button>
				</div>

				<!-- Tab content -->
				<div id="theme_activation" class="tabcontent open">

					<div class="theme_activation-wrapper">
						<div class="theme_activation_spinner">
							<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin:auto;background:#fff;display:block;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
								<g transform="translate(50,50)">
								  <g transform="scale(0.7)">
								  <circle cx="0" cy="0" r="50" fill="#0f81d0"></circle>
								  <circle cx="0" cy="-28" r="15" fill="#cfd7dd">
								    <animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" keyTimes="0;1" values="0 0 0;360 0 0"></animateTransform>
								  </circle>
								  </g>
								</g>
							</svg>
						</div>
						<div class="theme-wizard-key-status">
							<?php
								if ( $theme_validation_status === 'false' ) {
									esc_html_e('Theme License Key is not activated!','vw-book-store-pro');
								} else {
									esc_html_e('Theme License is Activated!','vw-book-store-pro');
								}
							?>
						</div>
						<?php $this->activation_page(); ?>
					</div>
				</div>
				<div id="demo_offer" class="tabcontent">
					<?php $this->wizard_page(); ?>
				</div>
				<div id="theme_info" class="tabcontent">
					<div class="col-left-inner">
						<h3><?php _e( 'VW Book Store Pro Information', 'vw-book-store-pro' ); ?></h3>
						<hr class="h3hr">
						<h4><?php _e( 'Theme Documentation', 'vw-book-store-pro' ); ?></h4>
						<p><?php _e( 'If you need any assistance regarding setting up and configuring the Theme, our documentation is there.', 'vw-book-store-pro' ); ?></p>
						<div class="info-link">
							<a href="<?php echo esc_url( vw_book_store_pro_THEME_DOC ); ?>" target="_blank"> <?php _e( 'Documentation', 'vw-book-store-pro' ); ?></a>
						</div>
						<hr>
						<h4><?php _e('Having Trouble, Need Support?', 'vw-book-store-pro'); ?></h4>
						<p> <?php _e('Our dedicated team is well prepared to help you out in case of queries and doubts regarding our theme.', 'vw-book-store-pro'); ?></p>
						<div class="info-link">
							<a href="<?php echo esc_url( vw_book_store_pro_SUPPORT ); ?>" target="_blank"><?php _e('Support Forum', 'vw-book-store-pro'); ?></a>
						</div>
						<hr>
						<h4><?php _e('Reviews & Testimonials', 'vw-book-store-pro'); ?></h4>
						<p> <?php _e('All the features and aspects of this WordPress Theme are phenomenal. I\'d recommend this theme to all.', 'vw-book-store-pro'); ?>  </p>
						<div class="info-link">
							<a href="<?php echo esc_url( vw_book_store_pro_REVIEW ); ?>" target="_blank"><?php _e('Reviews', 'vw-book-store-pro'); ?></a>
						</div>
					</div>
					<div class="col-right-inner">
						<div id="vw-demo-setup-guid">
							<h3><?php esc_html_e('Checkout our setup videos','vw-book-store-pro'); ?></h3><hr />
					<ul>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/nLB9E6BBBv0"><span class="dashicons dashicons-welcome-widgets-menus"></span>Setup Menu</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/gjccwcAK47o"><span class="dashicons dashicons-email-alt"></span>Setup Contact Page</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/7BvTpLh-RB8"><span class="dashicons dashicons-editor-table"></span>Setup Widgets</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/Mox298rk0Qo"><span class="dashicons dashicons-share"></span>Setup Social Icon</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/hLtS4sztAX4"><span class="dashicons dashicons-wordpress-alt"></span>Install WordPress Theme</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/8UxkXkix-ic"><span class="dashicons dashicons-admin-users"></span>Create WordPress User</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/1xGlbWOzQBg"><span class="dashicons dashicons-image-flip-horizontal"></span>Setup Slider</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/pJFF_wjdvcA"><span class="dashicons dashicons-database"></span>WordPress Backup</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/xXdnUTPG_6A"><span class="dashicons dashicons-instagram"></span>Connect Instagram</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/leLBzmbvdQQ"><span class="dashicons dashicons-table-col-delete"></span>Fix 404 Error</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/OPBONJBtO6g"><span class="dashicons dashicons-admin-page"></span>Setup Template Pages</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/j7veMuhcXYA"><span class="dashicons dashicons-video-alt3"></span>Create a New Post</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/ovcok3FPRto"><span class="dashicons dashicons-welcome-add-page"></span>Setup Shortcode Pages</a>
								</li>
								<li>
									<a href="javascript:void(0);" doc-video-url="https://www.youtube.com/embed/O6elK2kSHQw"><span class="dashicons dashicons-images-alt2"></span>Setup Gallery Plugin</a>
								</li>
							</ul>
						</div>
					</div>
				</div>
				</div>
				<div class="wz-video-model">
					<span class="dashicons dashicons-no"></span>
					<iframe width="100%" src="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
				</div>
				<div id="plugins" class="tabcontent">
					<div class="wizard-plugin-wrapper">
						<div class="o-product-row">
							<div class="plugin-col ibtana-plugin-col">
								<img src="<?php echo esc_url(get_template_directory_uri().'/theme-wizard/assets/images/banner-772x250.png'); ?>">
								<h3><?php echo esc_html('Ibtana - WordPress Website Builder Plugin'); ?></h3>
								<p><?php echo esc_html('Ibtana Gutenberg Editor has ready made eye catching responsive templates build with custom blocks and options to extend Gutenberg’s default capabilities. You can easily import demo content for the block or templates with a single click'); ?></p>
								<?php
								$plugin_ins = Vw_Premium_Theme_Plugin_Activation_Settings::get_instance();
								$vw_theme_actions = $plugin_ins->recommended_actions;

								if ($vw_theme_actions): foreach ($vw_theme_actions as $key => $vw_theme_actionValue):
								?>
								<div class="ibtana-activation-btn">
									<?php echo wp_kses_post($vw_theme_actionValue['link']); ?>
								</div>
								<?php endforeach;
				        		endif; ?>
							</div>
							<div class="plugin-col">
								<img src="<?php echo esc_url(get_template_directory_uri().'/theme-wizard/assets/images/Ibtana-ecommerce-banner.png'); ?>">

								<h3><?php echo esc_html('Ibtana – Woocommerce Product Addons'); ?></h3>
								<p><?php echo esc_html('Ibtana – Ecommerce Product Addons is excellent for designing a highly customized product page that shows your products in a more prominent and interesting way. With these product add ons, creating unique product pages is now possible.'); ?></p>
								<a href="<?php echo esc_url('https://www.vwthemes.com/plugins/woocommerce-product-add-ons/'); ?>" target="_blank"><?php echo esc_html('Buy Now'); ?></a>
							</div>
							<div class="plugin-col">
								<img src="<?php echo esc_url(get_template_directory_uri().'/theme-wizard/assets/images/mega-menu.png'); ?>">

								<h3><?php echo esc_html('Ibtana- Mega Menu Addon'); ?></h3>
								<p><?php echo esc_html('View our mega menu demos or start the setup wizard which will guide you through all the steps to set up your menus.'); ?></p>
								<a href="<?php echo esc_url('https://www.vwthemes.com/plugins/woocommerce-product-add-ons/'); ?>" target="_blank"><?php echo esc_html('Buy Now'); ?></a>
							</div>
							<div class="plugin-col">
								<img src="<?php echo esc_url(get_template_directory_uri().'/theme-wizard/assets/images/VWThemes_banner_plugin.png'); ?>">
								<h3><?php echo esc_html('Title Banner Image Plugin'); ?></h3>
								<p><?php echo esc_html('If you are interested in adding the banner images, you check VW Title Banner Plugin. Its main speciality is that it permits user the addition of banner image on post, custom post or any page. '); ?></p>
								<a href="<?php echo esc_url('https://www.vwthemes.com/premium-plugin/vw-title-banner-plugin/'); ?>" target="_blank"><?php echo esc_html('Buy Now'); ?></a>
							</div>
							
							<div class="plugin-col">
								<img src="<?php echo esc_url(get_template_directory_uri().'/theme-wizard/assets/images/gallery_plugin_banner.png'); ?>">

								<h3><?php echo esc_html('VW Gallery Images Plugin'); ?></h3>
								<p><?php echo esc_html('The VW Gallery Plugin is an amazing WordPress gallery plugin. It helps you in creating the elegant gallery within few minutes. The VW Gallery plugin offers the advantage of displaying multiple galleries on a single page or post.'); ?></p>
								<a href="<?php echo esc_url('https://www.vwthemes.com/premium-plugin/vw-gallery-plugin/'); ?>" target="_blank"><?php echo esc_html('Buy Now'); ?></a>
							</div>

						</div>
					</div>
				</div>
				<div id="others_theme" class="tabcontent">
					<script>

						var data_post={"para":"1"};

					    jQuery.ajax({
					      method: "POST",
					      url: "https://www.vwthemes.com/wp-json/ibtana-licence/v2/get_modal_contents",
					      data: JSON.stringify(data_post),
					      dataType: 'json',
					      contentType: 'application/json',
					    }).done(function( data ) {
					    	/*console.log(data);*/
					    	var premium_data = data.data.products;
					    	for (var i = 0; i < premium_data.length; i++) {
						          var premium_product = premium_data[i];
						          var card_content = `<div class="o-products-col" data-id="`+premium_product.id+`">
						          	<div class="o-products-image">
						          		<img src="`+premium_product.image+`">
						          	</div>
						          	<h3>`+premium_product.title+`</h3>
						          	<a href="`+premium_product.permalink+`" target="_blank">Buy Now</a>
						          	<a href="`+premium_product.demo_url+`" target="_blank">View Demo</a>
						          </div>`;
						        jQuery('.wz-spinner-wrap').css('display','none');
	          					jQuery('#other-products .o-product-row').append(card_content);
	        				}

	        				var premium_category = data.data.sub;
	        				var active_class=""
	        				/*console.log(premium_category.length);*/
					    	for (let i = 0; i < premium_category.length; i++) {
					    		if(i==0){
					    			active_class="active";
					    		}else{
					    			active_class="";
					    		}
				    			let premium_product = premium_category[i];
					          	let card_content = `<li data-ids="`+premium_product.product_ids+`" onclick="other_products(this);" class="`+active_class+`">
					          		`+premium_product.name+`<span class="badge badge-info">`+premium_product.product_ids.length+`</span>
					          	</li>`;
          						jQuery('.o-product-col-1 ul').append(card_content);
					    	}
					    });

					    function other_products(content){

					    	jQuery('.o-product-col-1 ul li').attr('class','');
					        content.classList.add("active");
				            var data_ids = jQuery(content).attr('data-ids');

				            var id_arr = data_ids.split(',');
				            jQuery('.o-product-row .o-products-col[data-id]').hide();
				            for (var i = 0; i < id_arr.length; i++) {
				                var single_id = id_arr[i];
				                jQuery('.o-product-row .o-products-col[data-id="'+single_id+'"]').show();
				            }

					    }

					</script>
					<div id="other-products">
						<div class="wz-spinner-wrap">
							<div class="lds-dual-ring"></div>
						</div>
						<div class="o-product-main-row">
							<div class="o-product-col-1">
								<ul>

								</ul>
							</div>
							<div class="o-product-col-2">
								<div class="social-theme-search">
				                    <input class="themesearchinput" type="text" placeholder="Search Theme Here">
				                </div>
								<div class="o-product-row" style="clear: both;">

								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

	<?php }


	// Add a Custom CSS file to WP Admin Area
	public function vw_book_store_pro_admin_theme_style() {
		wp_enqueue_style( 'vw-book-store-pro-font', $this->vw_book_store_pro_admin_font_url(), array() );
		wp_enqueue_style('custom-admin-style', get_template_directory_uri() . '/theme-wizard/getstarted/getstart.css');
		//( 'tab', get_template_directory_uri() . '/theme-wizard/getstarted/js/tab.js' );
	}

	// Theme Font URL
	public function vw_book_store_pro_admin_font_url() {
		$font_url = '';
		$font_family = array();
		$font_family[] = 'Muli:300,400,600,700,800,900';

		$query_args = array(
			'family'	=> urlencode(implode('|',$font_family)),
		);
		$font_url = add_query_arg($query_args,'//fonts.googleapis.com/css');
		return $font_url;
	}
}