<?php

class Whizzie {

	public function __construct() {
		$this->init();
	}

	public function init()
	{
	
	}

	public static function eco_nature_elementor_setup_widgets(){

		set_theme_mod( 'eco_nature_elementor_header_advertisement_text', 'FreshFarm Grown Vegetablwe Now Available At Your Door Step!' );
		set_theme_mod( 'eco_nature_elementor_header_location', '1870Lorem Ipsum Dolor SitAmet' );
		set_theme_mod( 'eco_nature_elementor_header_email', 'business@farm.com' );
		set_theme_mod( 'eco_nature_elementor_header_phone_number', '123 456 789' );
		set_theme_mod( 'eco_nature_elementor_header_phone_number_text', 'Have A Question' );
		set_theme_mod( 'eco_nature_elementor_header_button_text', 'ORDER NOW' );
		set_theme_mod( 'eco_nature_elementor_header_button_url', '#' );
		set_theme_mod('eco_nature_elementor_social_links_settings', array(
            array(
                "link_text" => "fab fa-instagram",
                "link_url" => "www.instagram.com"
            ),
            array(
                "link_text" => "fab fa-twitter",
                "link_url" => "www.twitter.com"
            ),
            array(
                "link_text" => "fab fa-youtube",
                "link_url" => "www.youtube.com"
            ),
            array(
                "link_text" => "fab fa-linkedin-in",
                "link_url" => "www.linkedin.com"
            )
        ));

        /* Create Menu */
            $eco_nature_elementor_menuname  = 'Main Menu';
            $eco_nature_elementor_location  = 'main-menu';

            $eco_nature_elementor_menu = wp_get_nav_menu_object( $eco_nature_elementor_menuname );

            if ( ! $eco_nature_elementor_menu ) {
            $eco_nature_elementor_menu_id = wp_create_nav_menu( $eco_nature_elementor_menuname );

           // Home Page 
			wp_update_nav_menu_item( $eco_nature_elementor_menu_id, 0, array(
				'menu-item-title'     => __( 'Home', 'eco-nature-elementor' ),
				'menu-item-url'       => home_url( '/' ),
				'menu-item-type'      => 'custom',
				'menu-item-status'    => 'publish',
				'menu-item-position'  => 1,
			) );

			// About Us Page 
			$eco_nature_elementor_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'About Us',
			'post_status' => 'publish',
			) );

			if ( $eco_nature_elementor_about_id ) {
			wp_update_nav_menu_item( $eco_nature_elementor_menu_id, 0, array(
			'menu-item-title'     => 'About Us',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $eco_nature_elementor_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
            'menu-item-position'  => 2,
			) );
			}

            // Services Page 
			$eco_nature_elementor_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'Services',
			'post_status' => 'publish',
			) );

			if ( $eco_nature_elementor_about_id ) {
			wp_update_nav_menu_item( $eco_nature_elementor_menu_id, 0, array(
			'menu-item-title'     => 'Services',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $eco_nature_elementor_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
            'menu-item-position'  => 2,
			) );
			}

			// Contact Us Page 
			$eco_nature_elementor_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'Contact Us',
			'post_status' => 'publish',
			) );

			if ( $eco_nature_elementor_about_id ) {
			wp_update_nav_menu_item( $eco_nature_elementor_menu_id, 0, array(
			'menu-item-title'     => 'Contact Us',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $eco_nature_elementor_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
            'menu-item-position'  => 4,
			) );
			}

			// Pages Page 
			$eco_nature_elementor_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'Pages',
			'post_status' => 'publish',
			) );

			if ( $eco_nature_elementor_about_id ) {
			wp_update_nav_menu_item( $eco_nature_elementor_menu_id, 0, array(
			'menu-item-title'     => 'Pages',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $eco_nature_elementor_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
            'menu-item-position'  => 4,
			) );
			}

            // Create Shop Page
                $eco_nature_elementor_about_title = 'Shop';
                $eco_nature_elementor_about_content = 'Lorem ipsum dolor sit amet...';

                $shop_page = get_page_by_path('shop');
                if ( !$shop_page ) {
                    $eco_nature_elementor_about = array(
                        'post_type'   => 'page',
                        'post_title'  => $eco_nature_elementor_about_title,
                        'post_content'=> $eco_nature_elementor_about_content,
                        'post_status' => 'publish',
                        'post_author' => 1,
                        'post_name'   => 'shop' 
                        );
                        $eco_nature_elementor_about_id = wp_insert_post($eco_nature_elementor_about);
                    } else {
                        $eco_nature_elementor_about_id = $shop_page->ID;
                    }

                    wp_update_nav_menu_item($eco_nature_elementor_menu_id, 0, array(
                        'menu-item-title'   => __('Shop', 'eco-nature-elementor'),
                        'menu-item-classes' => 'shop',
                        'menu-item-object-id' => $eco_nature_elementor_about_id,
                        'menu-item-object'  => 'page',
                        'menu-item-type'    => 'post_type',
                        'menu-item-status'  => 'publish'
                    ));

			/* ---------- Assign Menu Location ---------- */
			$eco_nature_elementor_locations = get_theme_mod( 'nav_menu_locations', array() );
			$eco_nature_elementor_locations[ $eco_nature_elementor_location ] = $eco_nature_elementor_menu_id;
			set_theme_mod( 'nav_menu_locations', $eco_nature_elementor_locations );
		}
	}
}
 