<?php

class Whizzie {

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

	public function init()
	{
	
	}

	public static function carpenter_services_setup_widgets(){


	set_theme_mod( 'carpenter_services_header_phone_number', '+1234567890' );
	set_theme_mod( 'carpenter_services_header_email', 'echogroove@example.com' );
	set_theme_mod( 'carpenter_services_header_adver_text', 'Limited Time Offer: 15% Off All Custom Furniture orders Ends Sunday!' );

	/* Create Menu */
            $carpenter_services_menuname  = 'Main Menus';
            $carpenter_services_location  = 'main-menu';

            $carpenter_services_menu = wp_get_nav_menu_object( $carpenter_services_menuname );

            if ( ! $carpenter_services_menu ) {
            $carpenter_services_menu_id = wp_create_nav_menu( $carpenter_services_menuname );

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

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

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

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

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

            // CREATE SHOP PAGE
                $carpenter_services_about_title = 'Shop';
                $carpenter_services_about_content = 'Lorem ipsum dolor sit amet...';

                $shop_page = get_page_by_path('shop');
                if ( !$shop_page ) {
                    $carpenter_services_about = array(
                        'post_type'   => 'page',
                        'post_title'  => $carpenter_services_about_title,
                        'post_content'=> $carpenter_services_about_content,
                        'post_status' => 'publish',
                        'post_author' => 1,
                        'post_name'   => 'shop' 
                        );
                        $carpenter_services_about_id = wp_insert_post($carpenter_services_about);
                    } else {
                        $carpenter_services_about_id = $shop_page->ID;
                    }

                    wp_update_nav_menu_item($carpenter_services_menu_id, 0, array(
                        'menu-item-title'   => __('Shop', 'carpenter-services'),
                        'menu-item-classes' => 'shop',
                        'menu-item-object-id' => $carpenter_services_about_id,
                        'menu-item-object'  => 'page',
                        'menu-item-type'    => 'post_type',
                        'menu-item-status'  => 'publish'
                    ));
            
			/* ---------- Assign Menu Location ---------- */
			$carpenter_services_locations = get_theme_mod( 'nav_menu_locations', array() );
			$carpenter_services_locations[ $carpenter_services_location ] = $carpenter_services_menu_id;
			set_theme_mod( 'nav_menu_locations', $carpenter_services_locations );
		}
	
	}
}
 