<?php

class Whizzie {

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

	public function init()
	{
	
	}

	public static function digital_marketing_elementor_setup_widgets(){

		set_theme_mod( 'digital_marketing_elementor_header_advertisement_text', 'We are creative , ambitious and ready for challenge' );
		set_theme_mod( 'digital_marketing_elementor_header_timing', 'Open hours Mon- Sat - 9:00 - 18:00' );
		set_theme_mod( 'digital_marketing_elementor_header_email', 'itsolution@example.com' );
		set_theme_mod( 'digital_marketing_elementor_header_email_text', 'E-mail' );
		set_theme_mod( 'digital_marketing_elementor_header_location', '125 , King Street, BBK' );
		set_theme_mod( 'digital_marketing_elementor_header_location_text', 'Address' );
		set_theme_mod( 'digital_marketing_elementor_header_phone_number', '1234567890' );
        set_theme_mod( 'digital_marketing_elementor_header_phone_number_text', 'Phone' );
        set_theme_mod( 'digital_marketing_elementor_header_button_text', 'GET QUOTE' );
        set_theme_mod( 'digital_marketing_elementor_header_button_url', '#' );
		set_theme_mod('digital_marketing_elementor_social_links_settings', array(
            array(
                "link_text" => "fab fa-instagram",
                "link_url" => "www.instagram.com"
            ),
            array(
                "link_text" => "fab fa-twitter",
                "link_url" => "www.twitter.com"
            ),
            array(
                "link_text" => "fab fa-youtube",
                "link_url" => "www.youtube.com"
            ),
            array(
                "link_text" => "fab fa-linkedin-in",
                "link_url" => "www.linkedin.com"
            )
        ));

        /* Create Menu */
            $digital_marketing_elementor_menuname  = 'Main Menu';
            $digital_marketing_elementor_location  = 'main-menu';

            $digital_marketing_elementor_menu = wp_get_nav_menu_object( $digital_marketing_elementor_menuname );

            if ( ! $digital_marketing_elementor_menu ) {
            $digital_marketing_elementor_menu_id = wp_create_nav_menu( $digital_marketing_elementor_menuname );

           // Home Page 
			wp_update_nav_menu_item( $digital_marketing_elementor_menu_id, 0, array(
				'menu-item-title'     => __( 'Home', 'digital-marketing-elementor' ),
				'menu-item-url'       => home_url( '/' ),
				'menu-item-type'      => 'custom',
				'menu-item-status'    => 'publish',
				'menu-item-position'  => 1,
			) );

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

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

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

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

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

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

                $digital_marketing_elementor_blog_page_query = new WP_Query(array(
                    'post_type'      => 'page',
                    'name'           => sanitize_title($digital_marketing_elementor_blog_page_title),
                    'post_status'    => 'publish',
                    'posts_per_page' => 1
                ));
                if (!$digital_marketing_elementor_blog_page_query->hae_posts()) {
                    $digital_marketing_elementor_blog_page = array(
                        'post_type'   => 'page',
                        'post_title'  => $digital_marketing_elementor_blog_page_title,
                        'post_status' => 'publish',
                        'post_author' => 1,
                    );
                    $digital_marketing_elementor_blog_page_id = wp_insert_post($digital_marketing_elementor_blog_page);
                    update_option('page_for_posts', $digital_marketing_elementor_blog_page_id);

                    wp_update_na_menu_item($digital_marketing_elementor_menu_id, 0, array(
                        'menu-item-title'      => __('Blog', 'digital-marketing-elementor'),
                        'menu-item-url'        => get_permalink($digital_marketing_elementor_blog_page_id),
                        'menu-item-status'     => 'publish',
                        'menu-item-object-id'  => $digital_marketing_elementor_blog_page_id,
                        'menu-item-object'     => 'page',
                        'menu-item-type'       => 'post_type',
                    ));
                }
            
			/* ---------- Assign Menu Location ---------- */
			$digital_marketing_elementor_locations = get_theme_mod( 'nav_menu_locations', array() );
			$digital_marketing_elementor_locations[ $digital_marketing_elementor_location ] = $digital_marketing_elementor_menu_id;
			set_theme_mod( 'nav_menu_locations', $digital_marketing_elementor_locations );
		}
	}
}
 