<?php

class Whizzie {

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

	public function init()
	{
	
	}

	public static function career_counseling_setup_widgets(){

		set_theme_mod( 'career_counseling_header_button_text', 'Get A Quote' );
		set_theme_mod( 'career_counseling_header_button_link', '#' );

		/* Create Menu */
            $career_counseling_menuname  = 'Main Menus';
            $career_counseling_location  = 'primary';

            $career_counseling_menu = wp_get_nav_menu_object( $career_counseling_menuname );

            if ( ! $career_counseling_menu ) {
            $career_counseling_menu_id = wp_create_nav_menu( $career_counseling_menuname );

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

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

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

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

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

            $career_counseling_blog_page_query = new WP_Query(array(
            'post_type'      => 'page',
            'name'           => sanitize_title($career_counseling_blog_page_title),
            'post_status'    => 'publish',
            'posts_per_page' => 1
            ));
            if (!$career_counseling_blog_page_query->have_posts()) {
            $career_counseling_blog_page = array(
            'post_type'   => 'page',
            'post_title'  => $career_counseling_blog_page_title,
            'post_status' => 'publish',
            'post_author' => 1,
            );
            $career_counseling_blog_page_id = wp_insert_post($career_counseling_blog_page);
            update_option('page_for_posts', $career_counseling_blog_page_id);

            wp_update_nav_menu_item($career_counseling_menu_id, 0, array(
            'menu-item-title'      => __('Blog', 'career-counseling'),
            'menu-item-url'        => get_permalink($career_counseling_blog_page_id),
            'menu-item-status'     => 'publish',
            'menu-item-object-id'  => $career_counseling_blog_page_id,
            'menu-item-object'     => 'page',
            'menu-item-type'       => 'post_type',
            ));
            }
            
			/* ---------- Assign Menu Location ---------- */
			$career_counseling_locations = get_theme_mod( 'nav_menu_locations', array() );
			$career_counseling_locations[ $career_counseling_location ] = $career_counseling_menu_id;
			set_theme_mod( 'nav_menu_locations', $career_counseling_locations );
		}

	}
}
 