<?php
class Whizzie {

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

	public function init()
	{
	
	}
	public static function cultural_festival_setup_widgets(){
        $cultural_festival_options = get_theme_mod('theme_options', []);
        $cultural_festival_options['cultural_festival_quote_button_link'] = '#';
        $cultural_festival_options['cultural_festival_quote_button_text'] = 'Get A Quote';

        /* Create Menu */
            $cultural_festival_menuname  = 'Primary Menu';
            $cultural_festival_location  = 'primary';

            $cultural_festival_menu = wp_get_nav_menu_object( $cultural_festival_menuname );

            if ( ! $cultural_festival_menu ) {
            $cultural_festival_menu_id = wp_create_nav_menu( $cultural_festival_menuname );

           // Home Page 
			wp_update_nav_menu_item( $cultural_festival_menu_id, 0, array(
				'menu-item-title'     => __( 'Home', 'cultural-festival' ),
				'menu-item-url'       => home_url( '/' ),
				'menu-item-type'      => 'custom',
				'menu-item-status'    => 'publish',
			) );

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

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

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

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

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

                $cultural_festival_blog_page_query = new WP_Query(array(
                    'post_type'      => 'page',
                    'name'           => sanitize_title($cultural_festival_blog_page_title),
                    'post_status'    => 'publish',
                    'posts_per_page' => 1
                ));
                if (!$cultural_festival_blog_page_query->hae_posts()) {
                    $cultural_festival_blog_page = array(
                        'post_type'   => 'page',
                        'post_title'  => $cultural_festival_blog_page_title,
                        'post_status' => 'publish',
                        'post_author' => 1,
                    );
                    $cultural_festival_blog_page_id = wp_insert_post($cultural_festival_blog_page);
                    update_option('page_for_posts', $cultural_festival_blog_page_id);

                    wp_update_na_menu_item($cultural_festival_menu_id, 0, array(
                        'menu-item-title'      => __('Blog', 'cultural-festival'),
                        'menu-item-url'        => get_permalink($cultural_festival_blog_page_id),
                        'menu-item-status'     => 'publish',
                        'menu-item-object-id'  => $cultural_festival_blog_page_id,
                        'menu-item-object'     => 'page',
                        'menu-item-type'       => 'post_type',
                    ));
                }

			// Contact Us Page 
			$cultural_festival_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 ( $cultural_festival_about_id ) {
			wp_update_nav_menu_item( $cultural_festival_menu_id, 0, array(
			'menu-item-title'     => 'Contact Us',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $cultural_festival_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}
            
			/* Assign Menu Location */
			$cultural_festival_locations = get_theme_mod( 'nav_menu_locations', array() );
			$cultural_festival_locations[ $cultural_festival_location ] = $cultural_festival_menu_id;
			set_theme_mod( 'nav_menu_locations', $cultural_festival_locations );
		}
        set_theme_mod('theme_options', $cultural_festival_options);
    }
}