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

class ThemeWhizzie {

	protected $version = '1.1.0';

	/** @var string Current theme name, used as namespace in actions. */
	protected $theme_name = '';
	protected $theme_title = '';
	public $parent_slug;
	/** @var string Demo Import page slug and title. */
	protected $page_slug = '';
	protected $page_title = '';

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

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

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

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

	/**
	 * Hooks and filters
	 * @since 1.0.0
	*/
	public function init() {
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
		add_action( 'admin_menu', array( $this, 'menu_page' ) );
		add_action( 'wp_ajax_setup_widgets', array( $this, 'setup_widgets' ) );
	}

	public function enqueue_scripts() {
		wp_enqueue_style( 'demo-import-style', get_template_directory_uri() . '/demo-import/assets/css/demo-import-style.css');
		wp_register_script( 'demo-import-script', get_template_directory_uri() . '/demo-import/assets/js/demo-import-script.js', array( 'jquery' ), time() );
		wp_localize_script(
			'demo-import-script',
			'dairy_farming_whizzie_params',
			array(
				'ajaxurl' 		=> admin_url( 'admin-ajax.php' ),
				'wpnonce' 		=> wp_create_nonce( 'whizzie_nonce' ),
				'verify_text'	=> esc_html( 'verifying', 'dairy-farming' )
			)
		);
		wp_enqueue_script( 'demo-import-script' );
	}

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

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

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

	/**    Print the content for the intro step     **/
		public function get_step_importer() { ?>
		<div class="summary">
			<p>
				<?php esc_html_e('Thank you for choosing this Dairy Farming 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.','dairy-farming'); ?>
			</p>
		</div>
	<?php }

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

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

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

	<?php }


	public function dairy_farming_customizer_nav_menu() {
		// ------- Create Primary Menu --------
		$dairy_farming_themename = 'Dairy Farming'; // Ensure the theme name is set
		$dairy_farming_menuname = $dairy_farming_themename . ' Primary Menu';
		$dairy_farming_menulocation = 'menu-1';
		$dairy_farming_menu_exists = wp_get_nav_menu_object($dairy_farming_menuname);

		if (!$dairy_farming_menu_exists) {
			$dairy_farming_menu_id = wp_create_nav_menu($dairy_farming_menuname);

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

			// About
			$dairy_farming_page_about = get_page_by_path('about');
			if($dairy_farming_page_about){
				wp_update_nav_menu_item($dairy_farming_menu_id, 0, array(
					'menu-item-title' => __('About', 'dairy-farming'),
					'menu-item-classes' => 'about',
					'menu-item-url' => get_permalink($dairy_farming_page_about),
					'menu-item-status' => 'publish'
				));
			}

			// Services
			$dairy_farming_page_services = get_page_by_path('services');
			if($dairy_farming_page_services){
				wp_update_nav_menu_item($dairy_farming_menu_id, 0, array(
					'menu-item-title' => __('Services', 'dairy-farming'),
					'menu-item-classes' => 'services',
					'menu-item-url' => get_permalink($dairy_farming_page_services),
					'menu-item-status' => 'publish'
				));
			}

			// Pages
			$dairy_farming_page_pages = get_page_by_path('pages');
			if($dairy_farming_page_pages){
				wp_update_nav_menu_item($dairy_farming_menu_id, 0, array(
					'menu-item-title' => __('Pages', 'dairy-farming'),
					'menu-item-classes' => 'pages',
					'menu-item-url' => get_permalink($dairy_farming_page_pages),
					'menu-item-status' => 'publish'
				));
			}

			// Blog
			$dairy_farming_page_blog = get_page_by_path('blog');
			if($dairy_farming_page_blog){
				wp_update_nav_menu_item($dairy_farming_menu_id, 0, array(
					'menu-item-title' => __('Blog', 'dairy-farming'),
					'menu-item-classes' => 'blog',
					'menu-item-url' => get_permalink($dairy_farming_page_blog),
					'menu-item-status' => 'publish'
				));
			}

			// Contact Us
			$dairy_farming_page_contact = get_page_by_path('contact');
			if($dairy_farming_page_contact){
				wp_update_nav_menu_item($dairy_farming_menu_id, 0, array(
					'menu-item-title' => __('Contact Us', 'dairy-farming'),
					'menu-item-classes' => 'contact',
					'menu-item-url' => get_permalink($dairy_farming_page_contact),
					'menu-item-status' => 'publish'
				));
			}

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

	public function dairy_farming_social_menu() {

		// ------- Create Social Menu --------
		$dairy_farming_menuname = $dairy_farming_themename . 'Social Menu';
		$dairy_farming_menulocation = 'social-menu';
		$dairy_farming_menu_exists = wp_get_nav_menu_object( $dairy_farming_menuname );

		if( !$dairy_farming_menu_exists){
			$dairy_farming_menu_id = wp_create_nav_menu($dairy_farming_menuname);

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

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

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

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

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

		//................................................. MENU PAGES .................................................//
		
		$dairy_farming_home_id='';
		$dairy_farming_home_content = '';

		$dairy_farming_home_title = 'Home';
		$dairy_farming_home = array(
				'post_type' => 'page',
				'post_title' => $dairy_farming_home_title,
				'post_content'  => $dairy_farming_home_content,
				'post_status' => 'publish',
				'post_author' => 1,
				'post_slug' => 'home'
		);
		$dairy_farming_home_id = wp_insert_post($dairy_farming_home);

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

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


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

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

		// Create a Contact Us page and assign the template
		$dairy_farming_contact_title = 'Contact Us';
		$dairy_farming_contact_check = get_page_by_path('contact');
		if (!$dairy_farming_contact_check) {
			$dairy_farming_contact = array(
				'post_type'    => 'page',
				'post_title'   => $dairy_farming_contact_title,
				'post_content'   => '"More About The Free Farming WordPress Theme"
										The Free Farming WordPress Theme comes with a layout that is thoughtfully crafted with agriculture in mind. It features a clean, practical, and visually appealing aesthetic that reflects the simplicity and authenticity of farming life. The color palette and imagery evoke the charm of rural landscapes, making visitors feel connected to the land and the farming experience. One of the primary advantages of the Free Farming WordPress Theme is its user-friendly nature. You don\'t need to be a web design expert to navigate and manage your website. Even those with limited technical knowledge can easily maintain their online presence, allowing farmers to focus on their core agricultural activities without the added burden of complex web development. The Free Farming WordPress Theme comes with several benefits that make it an excellent choice for farmers and agricultural enthusiasts.

										First and foremost, it\'s cost-free. Farmers often operate on tight budgets, and this theme provides a valuable solution without any financial burden. It empowers small-scale farmers and hobbyists to establish a strong online presence, showcase their work, and share their love for agriculture. While the theme is free, it doesnt skimp on customization options. You can tailor your website to reflect your unique brand and style. From selecting color schemes to uploading farm-related imagery, the Free Farming WordPress Theme ensures that your website is an accurate reflection of your agricultural identity.

										The theme includes a dedicated section for product listings, allowing farmers and agricultural businesses to showcase their range of products, whether its fresh produce, seeds, or farming equipment. This feature is particularly beneficial for those looking to sell their products directly through their website. In addition to product listings, the Free Farming WordPress Theme provides a blog platform. This allows users to share insights, farming tips, industry updates, and personal stories with the agricultural community. The internet allows farmers to reach potential customers, suppliers, and fellow enthusiasts worldwide. To ensure your website is discoverable, the theme is optimized for search engines (SEO). This means that its designed to perform well in search engine rankings, making it easier for potential visitors to find your website when searching for farming-related content. Social media is a powerful tool for farmers and agricultural businesses to connect with their audience. The Free Farming WordPress Theme includes social media integration, allowing you to seamlessly connect your website with your social media profiles. This enhances your online presence and makes it easier for visitors to follow you and engage with your content on various platforms.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'contact' // Unique slug for the Contact Us page
			);
			wp_insert_post($dairy_farming_contact);
		}

		// Create a About page and assign the template
		$dairy_farming_about_title = 'About';
		$dairy_farming_about_check = get_page_by_path('about');
		if (!$dairy_farming_about_check) {
			$dairy_farming_about = array(
				'post_type'    => 'page',
				'post_title'   => $dairy_farming_about_title,
				'post_content'   => '"More About The Free Farming WordPress Theme"
										The Free Farming WordPress Theme comes with a layout that is thoughtfully crafted with agriculture in mind. It features a clean, practical, and visually appealing aesthetic that reflects the simplicity and authenticity of farming life. The color palette and imagery evoke the charm of rural landscapes, making visitors feel connected to the land and the farming experience. One of the primary advantages of the Free Farming WordPress Theme is its user-friendly nature. You don\'t need to be a web design expert to navigate and manage your website. Even those with limited technical knowledge can easily maintain their online presence, allowing farmers to focus on their core agricultural activities without the added burden of complex web development. The Free Farming WordPress Theme comes with several benefits that make it an excellent choice for farmers and agricultural enthusiasts.

										First and foremost, it\'s cost-free. Farmers often operate on tight budgets, and this theme provides a valuable solution without any financial burden. It empowers small-scale farmers and hobbyists to establish a strong online presence, showcase their work, and share their love for agriculture. While the theme is free, it doesnt skimp on customization options. You can tailor your website to reflect your unique brand and style. From selecting color schemes to uploading farm-related imagery, the Free Farming WordPress Theme ensures that your website is an accurate reflection of your agricultural identity.

										The theme includes a dedicated section for product listings, allowing farmers and agricultural businesses to showcase their range of products, whether its fresh produce, seeds, or farming equipment. This feature is particularly beneficial for those looking to sell their products directly through their website. In addition to product listings, the Free Farming WordPress Theme provides a blog platform. This allows users to share insights, farming tips, industry updates, and personal stories with the agricultural community. The internet allows farmers to reach potential customers, suppliers, and fellow enthusiasts worldwide. To ensure your website is discoverable, the theme is optimized for search engines (SEO). This means that its designed to perform well in search engine rankings, making it easier for potential visitors to find your website when searching for farming-related content. Social media is a powerful tool for farmers and agricultural businesses to connect with their audience. The Free Farming WordPress Theme includes social media integration, allowing you to seamlessly connect your website with your social media profiles. This enhances your online presence and makes it easier for visitors to follow you and engage with your content on various platforms.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'about' // Unique slug for the About page
			);
			wp_insert_post($dairy_farming_about);
		}

		// Create a Pages page and assign the template
		$dairy_farming_pages_title = 'Pages';
		$dairy_farming_pages_check = get_page_by_path('pages');
		if (!$dairy_farming_pages_check) {
			$dairy_farming_pages = array(
				'post_type'    => 'page',
				'post_title'   => $dairy_farming_pages_title,
				'post_content'   => '"More About The Free Farming WordPress Theme"
										The Free Farming WordPress Theme comes with a layout that is thoughtfully crafted with agriculture in mind. It features a clean, practical, and visually appealing aesthetic that reflects the simplicity and authenticity of farming life. The color palette and imagery evoke the charm of rural landscapes, making visitors feel connected to the land and the farming experience. One of the primary advantages of the Free Farming WordPress Theme is its user-friendly nature. You don\'t need to be a web design expert to navigate and manage your website. Even those with limited technical knowledge can easily maintain their online presence, allowing farmers to focus on their core agricultural activities without the added burden of complex web development. The Free Farming WordPress Theme comes with several benefits that make it an excellent choice for farmers and agricultural enthusiasts.

										First and foremost, it\'s cost-free. Farmers often operate on tight budgets, and this theme provides a valuable solution without any financial burden. It empowers small-scale farmers and hobbyists to establish a strong online presence, showcase their work, and share their love for agriculture. While the theme is free, it doesnt skimp on customization options. You can tailor your website to reflect your unique brand and style. From selecting color schemes to uploading farm-related imagery, the Free Farming WordPress Theme ensures that your website is an accurate reflection of your agricultural identity.

										The theme includes a dedicated section for product listings, allowing farmers and agricultural businesses to showcase their range of products, whether its fresh produce, seeds, or farming equipment. This feature is particularly beneficial for those looking to sell their products directly through their website. In addition to product listings, the Free Farming WordPress Theme provides a blog platform. This allows users to share insights, farming tips, industry updates, and personal stories with the agricultural community. The internet allows farmers to reach potential customers, suppliers, and fellow enthusiasts worldwide. To ensure your website is discoverable, the theme is optimized for search engines (SEO). This means that its designed to perform well in search engine rankings, making it easier for potential visitors to find your website when searching for farming-related content. Social media is a powerful tool for farmers and agricultural businesses to connect with their audience. The Free Farming WordPress Theme includes social media integration, allowing you to seamlessly connect your website with your social media profiles. This enhances your online presence and makes it easier for visitors to follow you and engage with your content on various platforms.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'pages' // Unique slug for the Pages page
			);
			wp_insert_post($dairy_farming_pages);
		}

		// Create a Services page and assign the template
		$dairy_farming_services_title = 'Services';
		$dairy_farming_services_check = get_page_by_path('services');
		if (!$dairy_farming_services_check) {
			$dairy_farming_services = array(
				'post_type'    => 'page',
				'post_title'   => $dairy_farming_services_title,
				'post_content'   => '"More About The Free Farming WordPress Theme"
										The Free Farming WordPress Theme comes with a layout that is thoughtfully crafted with agriculture in mind. It features a clean, practical, and visually appealing aesthetic that reflects the simplicity and authenticity of farming life. The color palette and imagery evoke the charm of rural landscapes, making visitors feel connected to the land and the farming experience. One of the primary advantages of the Free Farming WordPress Theme is its user-friendly nature. You don\'t need to be a web design expert to navigate and manage your website. Even those with limited technical knowledge can easily maintain their online presence, allowing farmers to focus on their core agricultural activities without the added burden of complex web development. The Free Farming WordPress Theme comes with several benefits that make it an excellent choice for farmers and agricultural enthusiasts.

										First and foremost, it\'s cost-free. Farmers often operate on tight budgets, and this theme provides a valuable solution without any financial burden. It empowers small-scale farmers and hobbyists to establish a strong online presence, showcase their work, and share their love for agriculture. While the theme is free, it doesnt skimp on customization options. You can tailor your website to reflect your unique brand and style. From selecting color schemes to uploading farm-related imagery, the Free Farming WordPress Theme ensures that your website is an accurate reflection of your agricultural identity.

										The theme includes a dedicated section for product listings, allowing farmers and agricultural businesses to showcase their range of products, whether its fresh produce, seeds, or farming equipment. This feature is particularly beneficial for those looking to sell their products directly through their website. In addition to product listings, the Free Farming WordPress Theme provides a blog platform. This allows users to share insights, farming tips, industry updates, and personal stories with the agricultural community. The internet allows farmers to reach potential customers, suppliers, and fellow enthusiasts worldwide. To ensure your website is discoverable, the theme is optimized for search engines (SEO). This means that its designed to perform well in search engine rankings, making it easier for potential visitors to find your website when searching for farming-related content. Social media is a powerful tool for farmers and agricultural businesses to connect with their audience. The Free Farming WordPress Theme includes social media integration, allowing you to seamlessly connect your website with your social media profiles. This enhances your online presence and makes it easier for visitors to follow you and engage with your content on various platforms.',
					'post_status'  => 'publish',
				'post_author'  => 1,
				'post_name'    => 'services' // Unique slug for the Services page
			);
			wp_insert_post($dairy_farming_services);
		}


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

			set_theme_mod('dairy_farming_header_button_text','DONATE NOW');
			set_theme_mod('dairy_farming_header_button_link','#');

			set_theme_mod('dairy_farming_header_info_address','ADDESS 828 N. Iroquois Street Lincoln Park');
			set_theme_mod('dairy_farming_header_info_phone','PHONE +1234567890');
			set_theme_mod('dairy_farming_header_info_email','EMAIL ID info@dairy.com');

			set_theme_mod('dairy_farming_enable_slider',1);
			set_theme_mod('dairy_farming_enable_event',1);

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

			set_theme_mod('dairy_farming_slide_number','3');

			for($i=1;$i<=3;$i++){
				set_theme_mod( 'dairy_farming_slider_image'.$i,get_template_directory_uri().'/revolution/assets/image/slider'.$i.'.png' );
				set_theme_mod( 'dairy_farming_slider_heading'.$i, 'Dont denature the nature; it is a gift from God to us.' );
				set_theme_mod( 'dairy_farming_slider_text'.$i, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusm tempor incididunt in voluptate velit esse cillum dolore eu fugiat nulla culpa qui officia deserunt mollit anim id est laborum.' );
				set_theme_mod( 'dairy_farming_slider_button1_text'.$i, 'READ MORE' );
				set_theme_mod( 'dairy_farming_slider_button1_link'.$i, '#' );
			}

		// ------------------------------------------ Category Section -------------------------------------- //

			set_theme_mod('dairy_farming_event_heading','Dairy Farming Upcoming Events');
			set_theme_mod('dairy_farming_event_text','Latest Campaign');

			$heading = array(
				'Dairy Tech Expo 2025',
				'Sustainable Farming Workshop',
				'Livestock Health Conference',
				'Dairy Innovation Summit',
				'Modern Milking Systems Demo',
				'Organic Dairy Business Meet'
			);
			
			$location = array(
				'California, USA',
				'Yorkshire, UK',
				'Auckland, New Zealand',
				'Ontario, Canada',
				'Bavaria, Germany',
				'Gujarat, India'
			);
			
			$date = array(
				'19 May 2025',
				'03 Jun 2025',
				'15 Jun 2025',
				'28 Jun 2025',
				'12 Jul 2025',
				'25 Jul 2025'
			);
			
			for ($i = 1; $i <= 6; $i++) {
				set_theme_mod('dairy_farming_category_image' . $i, get_template_directory_uri() . '/revolution/assets/image/category' . $i . '.png');
				set_theme_mod('dairy_farming_category_heading' . $i, $heading[$i - 1]);
				set_theme_mod('dairy_farming_category_location_text' . $i, $location[$i - 1]);
				set_theme_mod('dairy_farming_category_date_text' . $i, $date[$i - 1]);
				set_theme_mod('dairy_farming_category_text' . $i, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.');
			}


  	 	$this->dairy_farming_customizer_nav_menu();
  	 	$this->dairy_farming_social_menu();
	}

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