<?php

class Whizzie {

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

	public function init()
	{
	
	}

	public static function travel_hiking_setup_widgets(){

		set_theme_mod( 'travel_hiking_header_advertisement_text', 'Its your time to start adventures ! check all upcoming adventure trekking' );
		set_theme_mod( 'travel_hiking_header_hiring_text', 'details here' );
		set_theme_mod( 'travel_hiking_header_hiring_url', '#' );
		set_theme_mod( 'travel_hiking_header_email', 'contact@example.com' );
		set_theme_mod( 'travel_hiking_header_phone_number', '+1234567890' );

		/* Create Menu */
            $travel_hiking_menuname  = 'Main Menus';
            $travel_hiking_location  = 'main-menu';

            $travel_hiking_menu = wp_get_nav_menu_object( $travel_hiking_menuname );

            if ( ! $travel_hiking_menu ) {
            $travel_hiking_menu_id = wp_create_nav_menu( $travel_hiking_menuname );

           // Home Page 
			wp_update_nav_menu_item( $travel_hiking_menu_id, 0, array(
				'menu-item-title'     => __( 'Home', 'travel-hiking' ),
				'menu-item-url'       => home_url( '/' ),
				'menu-item-type'      => 'custom',
				'menu-item-status'    => 'publish',
				'menu-item-position'  => 1,
			) );

			// About Page 
			$travel_hiking_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 ( $travel_hiking_about_id ) {
			wp_update_nav_menu_item( $travel_hiking_menu_id, 0, array(
			'menu-item-title'     => 'About Us',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $travel_hiking_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
            'menu-item-position'  => 2,
			) );
			}

			// Services Page 
			$travel_hiking_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 ( $travel_hiking_about_id ) {
			wp_update_nav_menu_item( $travel_hiking_menu_id, 0, array(
			'menu-item-title'     => 'Services',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $travel_hiking_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
            'menu-item-position'  => 3,
			) );
			}

			// Trekking Page 
			$travel_hiking_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'  => 'Trekking',
			'post_status' => 'publish',
			) );

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

            // Create Shop Page
                $travel_hiking_about_title = 'Shop';
                $travel_hiking_about_content = 'Lorem ipsum dolor sit amet...';

                $shop_page = get_page_by_path('shop');
                if ( !$shop_page ) {
                    $travel_hiking_about = array(
                        'post_type'   => 'page',
                        'post_title'  => $travel_hiking_about_title,
                        'post_content'=> $travel_hiking_about_content,
                        'post_status' => 'publish',
                        'post_author' => 1,
                        'post_name'   => 'shop' 
                        );
                        $travel_hiking_about_id = wp_insert_post($travel_hiking_about);
                    } else {
                        $travel_hiking_about_id = $shop_page->ID;
                    }

                    wp_update_nav_menu_item($travel_hiking_menu_id, 0, array(
                        'menu-item-title'   => __('Shop', 'travel-hiking'),
                        'menu-item-classes' => 'shop',
                        'menu-item-object-id' => $travel_hiking_about_id,
                        'menu-item-object'  => 'page',
                        'menu-item-type'    => 'post_type',
                        'menu-item-status'  => 'publish'
                    ));
            
			/* ---------- Assign Menu Location ---------- */
			$travel_hiking_locations = get_theme_mod( 'nav_menu_locations', array() );
			$travel_hiking_locations[ $travel_hiking_location ] = $travel_hiking_menu_id;
			set_theme_mod( 'nav_menu_locations', $travel_hiking_locations );
		}
	}
}
 