<?php

class Whizzie {

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

	public function init()
	{
	
	}

	public static function tour_booking_agency_setup_widgets(){

		set_theme_mod( 'tour_booking_agency_header_advertisement_text', 'Its your time to start adventures ! check all upcoming adventure trekking' );
		set_theme_mod( 'tour_booking_agency_header_hiring_text', 'details here' );
		set_theme_mod( 'tour_booking_agency_header_hiring_url', '#' );
		set_theme_mod( 'tour_booking_agency_header_email', 'travel@example.com' );
		set_theme_mod( 'tour_booking_agency_header_phone_number', '+1234567890' );

		/* Create Menu */
            $tour_booking_agency_menuname  = 'Main Menus';
            $tour_booking_agency_location  = 'main-menu';

            $tour_booking_agency_menu = wp_get_nav_menu_object( $tour_booking_agency_menuname );

            if ( ! $tour_booking_agency_menu ) {
            $tour_booking_agency_menu_id = wp_create_nav_menu( $tour_booking_agency_menuname );

           // Home Page 
			wp_update_nav_menu_item( $tour_booking_agency_menu_id, 0, array(
				'menu-item-title'     => __( 'Home', 'tour-booking-agency' ),
				'menu-item-url'       => home_url( '/' ),
				'menu-item-type'      => 'custom',
				'menu-item-status'    => 'publish',
			) );

			// Pages Page 
			$tour_booking_agency_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 ( $tour_booking_agency_about_id ) {
			wp_update_nav_menu_item( $tour_booking_agency_menu_id, 0, array(
			'menu-item-title'     => 'Pages',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $tour_booking_agency_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}

			// Contact Us Page 
			$tour_booking_agency_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 ( $tour_booking_agency_about_id ) {
			wp_update_nav_menu_item( $tour_booking_agency_menu_id, 0, array(
			'menu-item-title'     => 'Contact Us',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $tour_booking_agency_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}

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

			if ( $tour_booking_agency_about_id ) {
			wp_update_nav_menu_item( $tour_booking_agency_menu_id, 0, array(
			'menu-item-title'     => 'Packages',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $tour_booking_agency_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}

          // Create Blog Page
                $tour_booking_agency_blog_page_title = 'Blog';

                $tour_booking_agency_blog_page_query = new WP_Query(array(
                    'post_type'      => 'page',
                    'name'           => sanitize_title($tour_booking_agency_blog_page_title),
                    'post_status'    => 'publish',
                    'posts_per_page' => 1
                ));
                if (!$tour_booking_agency_blog_page_query->hae_posts()) {
                    $tour_booking_agency_blog_page = array(
                        'post_type'   => 'page',
                        'post_title'  => $tour_booking_agency_blog_page_title,
                        'post_status' => 'publish',
                        'post_author' => 1,
                    );
                    $tour_booking_agency_blog_page_id = wp_insert_post($tour_booking_agency_blog_page);
                    update_option('page_for_posts', $tour_booking_agency_blog_page_id);

                    wp_update_na_menu_item($tour_booking_agency_menu_id, 0, array(
                        'menu-item-title'      => __('Blog', 'tour-booking-agency'),
                        'menu-item-url'        => get_permalink($tour_booking_agency_blog_page_id),
                        'menu-item-status'     => 'publish',
                        'menu-item-object-id'  => $tour_booking_agency_blog_page_id,
                        'menu-item-object'     => 'page',
                        'menu-item-type'       => 'post_type',
                    ));
                }
            
			/* Assign Menu Location */
			$tour_booking_agency_locations = get_theme_mod( 'nav_menu_locations', array() );
			$tour_booking_agency_locations[ $tour_booking_agency_location ] = $tour_booking_agency_menu_id;
			set_theme_mod( 'nav_menu_locations', $tour_booking_agency_locations );
		}

	}
}
 