__('HOME', 'automobile-car-services'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url('/'), 'menu-item-status' => 'publish', )); wp_update_nav_menu_item($automobile_car_services_menu_id, 0, array( 'menu-item-title' => __('WHY US', 'automobile-car-services'), 'menu-item-classes' => 'why-us', 'menu-item-url' => get_permalink(get_page_id_by_title('WHY US')), 'menu-item-status' => 'publish', )); wp_update_nav_menu_item($automobile_car_services_menu_id, 0, array( 'menu-item-title' => __('BUY & SELL', 'automobile-car-services'), 'menu-item-classes' => 'buy&sell', 'menu-item-url' => get_permalink(get_page_id_by_title('BUY & SELL')), 'menu-item-status' => 'publish', )); wp_update_nav_menu_item($automobile_car_services_menu_id, 0, array( 'menu-item-title' => __('CAR RENTAL', 'automobile-car-services'), 'menu-item-classes' => 'car-rental', 'menu-item-url' => get_permalink(get_page_id_by_title('CAR RENTAL')), 'menu-item-status' => 'publish', )); wp_update_nav_menu_item($automobile_car_services_menu_id, 0, array( 'menu-item-title' => __('SPARE PARTS', 'automobile-car-services'), 'menu-item-classes' => 'spare-parts', 'menu-item-url' => get_permalink(get_page_id_by_title('SPARE PARTS')), 'menu-item-status' => 'publish', )); wp_update_nav_menu_item($automobile_car_services_menu_id, 0, array( 'menu-item-title' => __('BRANDS', 'automobile-car-services'), 'menu-item-classes' => 'brand', 'menu-item-url' => get_permalink(get_page_id_by_title('BRANDS')), 'menu-item-status' => 'publish', )); wp_update_nav_menu_item($automobile_car_services_menu_id, 0, array( 'menu-item-title' => __('CONTACT US', 'automobile-car-services'), 'menu-item-classes' => 'contact-us', 'menu-item-url' => get_permalink(get_page_id_by_title('CONTACT US')), 'menu-item-status' => 'publish', )); if (!has_nav_menu($automobile_car_services_bpmenulocation)) { $locations = get_theme_mod('nav_menu_locations'); $locations[$automobile_car_services_bpmenulocation] = $automobile_car_services_menu_id; set_theme_mod('nav_menu_locations', $locations); } } } public function setup_widgets() { $automobile_car_services_home_id=''; $automobile_car_services_home_content = ''; $automobile_car_services_home_title = 'HOME'; $automobile_car_services_home = array( 'post_type' => 'page', 'post_title' => $automobile_car_services_home_title, 'post_content' => $automobile_car_services_home_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'home' ); $automobile_car_services_home_id = wp_insert_post($automobile_car_services_home); add_post_meta( $automobile_car_services_home_id, '_wp_page_template', 'frontpage.php' ); update_option( 'page_on_front', $automobile_car_services_home_id ); update_option( 'show_on_front', 'page' ); // Create a Posts Page $automobile_car_services_blog_title = 'Why Us'; $automobile_car_services_blog_check = get_page_id_by_title($automobile_car_services_blog_title); if ($automobile_car_services_blog_check == 1) { $automobile_car_services_blog = array( 'post_type' => 'page', 'post_title' => $automobile_car_services_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'why-us', 'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', ); $automobile_car_services_blog_id = wp_insert_post($automobile_car_services_blog); if (!is_wp_error($automobile_car_services_blog_id)) { // update_option('page_for_posts', $automobile_car_services_blog_id); } } // Create a Posts Page $automobile_car_services_blog_title = 'BUY & SELL'; $automobile_car_services_blog_check = get_page_id_by_title($automobile_car_services_blog_title); if ($automobile_car_services_blog_check == 1) { $automobile_car_services_blog = array( 'post_type' => 'page', 'post_title' => $automobile_car_services_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'buy&sell', 'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', ); $automobile_car_services_blog_id = wp_insert_post($automobile_car_services_blog); if (!is_wp_error($automobile_car_services_blog_id)) { // update_option('page_for_posts', $automobile_car_services_blog_id); } } // Create a Posts Page $automobile_car_services_blog_title = 'CAR RENTAL'; $automobile_car_services_blog_check = get_page_id_by_title($automobile_car_services_blog_title); if ($automobile_car_services_blog_check == 1) { $automobile_car_services_blog = array( 'post_type' => 'page', 'post_title' => $automobile_car_services_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'car-rental', 'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', ); $automobile_car_services_blog_id = wp_insert_post($automobile_car_services_blog); if (!is_wp_error($automobile_car_services_blog_id)) { // update_option('page_for_posts', $automobile_car_services_blog_id); } } // Create a Posts Page $automobile_car_services_blog_title = 'SPARE PARTS'; $automobile_car_services_blog_check = get_page_id_by_title($automobile_car_services_blog_title); if ($automobile_car_services_blog_check == 1) { $automobile_car_services_blog = array( 'post_type' => 'page', 'post_title' => $automobile_car_services_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'spare-parts', 'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', ); $automobile_car_services_blog_id = wp_insert_post($automobile_car_services_blog); if (!is_wp_error($automobile_car_services_blog_id)) { // update_option('page_for_posts', $automobile_car_services_blog_id); } } // Create a Posts Page $automobile_car_services_blog_title = 'BRANDS'; $automobile_car_services_blog_check = get_page_id_by_title($automobile_car_services_blog_title); if ($automobile_car_services_blog_check == 1) { $automobile_car_services_blog = array( 'post_type' => 'page', 'post_title' => $automobile_car_services_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'brand', 'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', ); $automobile_car_services_blog_id = wp_insert_post($automobile_car_services_blog); if (!is_wp_error($automobile_car_services_blog_id)) { // update_option('page_for_posts', $automobile_car_services_blog_id); } } // Create a Posts Page $automobile_car_services_blog_title = 'CONTACT US'; $automobile_car_services_blog_check = get_page_id_by_title($automobile_car_services_blog_title); if ($automobile_car_services_blog_check == 1) { $automobile_car_services_blog = array( 'post_type' => 'page', 'post_title' => $automobile_car_services_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'contact-us', 'post_content' => '"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."', ); $automobile_car_services_blog_id = wp_insert_post($automobile_car_services_blog); if (!is_wp_error($automobile_car_services_blog_id)) { // update_option('page_for_posts', $automobile_car_services_blog_id); } } //---Header--// set_theme_mod( 'automobile_car_services_topbar_text', 'Free Delivery on orders over £120. Do not miss discount.'); set_theme_mod( 'automobile_car_services_topbar_opening_time', 'MON - FRI: 07:00 AM - 05:00 PM'); set_theme_mod( 'automobile_car_services_header_button_link', '#'); set_theme_mod( 'automobile_car_services_header_button_text', 'Lets Talk'); set_theme_mod('automobile_car_services_social_links_settings', array( array( "link_text" => "fab fa-instagram", "link_url" => "#" ), array( "link_text" => "fab fa-twitter", "link_url" => "#" ), array( "link_text" => "fab fa-youtube", "link_url" => "#" ), array( "link_text" => "fab fa-linkedin-in", "link_url" => "#" ) )); set_theme_mod( 'automobile_car_services_email_text', 'Mail Us'); set_theme_mod( 'automobile_car_services_email_address', 'project@interior.com'); set_theme_mod( 'automobile_car_services_phone_text', 'For Booking'); set_theme_mod( 'automobile_car_services_phone_number', '+9112345-06789'); //-----Slider-----// set_theme_mod( 'automobile_car_services_blog_box_enable', true); set_theme_mod( 'automobile_car_services_blog_slide_number', '3' ); $automobile_car_services_latest_post_category = wp_create_category('Slider Post'); set_theme_mod( 'automobile_car_services_blog_slide_category', 'Slider Post' ); set_theme_mod( 'automobile_car_services_slider_text_extra', 'TRUSTED EXPERIENCE'); for($i=1; $i<=3; $i++) { $automobile_car_services_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'; $title=array('BEST AUTO MOBILE DEALER IN YOUR TOWN', 'YOUR TOWN IS TOP AUTO MOBILE DEALER', 'THE BEST DEALER OF AUTOMOBILES IN YOUR TOWN'); // Create post object $automobile_car_services_my_post = array( 'post_title' => wp_strip_all_tags( $title[$i-1] ), 'post_content' => $automobile_car_services_content, 'post_status' => 'publish', 'post_type' => 'post', 'post_category' => array($automobile_car_services_latest_post_category) ); // Insert the post into the database $automobile_car_services_post_id = wp_insert_post( $automobile_car_services_my_post ); $automobile_car_services_image_url = get_template_directory_uri().'/assets/images/slider'.$i.'.png'; $automobile_car_services_image_name= 'slider'.$i.'.png'; $automobile_car_services_upload_dir = wp_upload_dir(); // Set upload folder $automobile_car_services_image_data = file_get_contents($automobile_car_services_image_url); // Get image data $automobile_car_services_unique_file_name = wp_unique_filename( $automobile_car_services_upload_dir['path'], $automobile_car_services_image_name ); // Generate unique name $filename= basename( $automobile_car_services_unique_file_name ); // Create image file name // Check folder permission and define file location if( wp_mkdir_p( $automobile_car_services_upload_dir['path'] ) ) { $file = $automobile_car_services_upload_dir['path'] . '/' . $filename; } else { $file = $automobile_car_services_upload_dir['basedir'] . '/' . $filename; } // Create the image file on the server if ( ! function_exists( 'WP_Filesystem' ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); } WP_Filesystem(); global $wp_filesystem; if ( ! $wp_filesystem->put_contents( $file, $automobile_car_services_image_data, FS_CHMOD_FILE ) ) { wp_die( 'Error saving file!' ); } $automobile_car_services_wp_filetype = wp_check_filetype( $filename, null ); $automobile_car_services_attachment = array( 'post_mime_type' => $automobile_car_services_wp_filetype['type'], 'post_title' => sanitize_file_name( $filename ), 'post_content' => '', 'post_type' => 'post', 'post_status' => 'inherit' ); $automobile_car_services_attach_id = wp_insert_attachment( $automobile_car_services_attachment, $file, $automobile_car_services_post_id ); require_once(ABSPATH . 'wp-admin/includes/image.php'); $automobile_car_services_attach_data = wp_generate_attachment_metadata( $automobile_car_services_attach_id, $file ); wp_update_attachment_metadata( $automobile_car_services_attach_id, $automobile_car_services_attach_data ); set_post_thumbnail( $automobile_car_services_post_id, $automobile_car_services_attach_id ); } //--------------Blog Section-----------// // Enable Trending Services section and set its theme mods set_theme_mod('automobile_car_services_what_we_do_section_enable', true); set_theme_mod('automobile_car_services_what_we_do_heading', 'WHAT WE DO'); set_theme_mod( 'automobile_car_services_what_we_do_left_number', '3' ); $automobile_car_services_latest_post_category = wp_create_category('What We Do 1'); set_theme_mod( 'automobile_car_services_what_we_do_left_category', 'What We Do 1' ); for ($i = 1; $i <= 3; $i++) { $automobile_car_services_content = 'Pellentesque risus ex, pretium non orci semper, tincidunt blandit orci.'; $title = array('Auto Balancing', 'Music Installation', 'Car Coloring'); $automobile_car_services_meta_1 = array('fas fa-car', 'fas fa-cog', 'fas fa-wrench'); // Create post object $automobile_car_services_my_post = array( 'post_title' => wp_strip_all_tags($title[$i - 1]), 'post_content' => $automobile_car_services_content, 'post_status' => 'publish', 'post_type' => 'post', 'post_category' => array($automobile_car_services_latest_post_category) ); // Insert the post into the database and get its ID $automobile_car_services_post_id = wp_insert_post($automobile_car_services_my_post); // Now that the post is created, update its meta if ($automobile_car_services_post_id) { $icon_class = $automobile_car_services_meta_1[$i - 1]; update_post_meta($automobile_car_services_post_id, 'automobile_car_services_icon', "( $icon_class )"); } } set_theme_mod( 'automobile_car_services_what_we_do_image',get_template_directory_uri().'/assets/images/what.png' ); set_theme_mod( 'automobile_car_services_what_we_do_right_number', '3' ); $automobile_car_services_latest_post_category = wp_create_category('What We Do 2'); set_theme_mod( 'automobile_car_services_what_we_do_right_category', 'What We Do 2' ); for ($i = 1; $i <= 3; $i++) { $automobile_car_services_content = 'Pellentesque risus ex, pretium non orci semper, tincidunt blandit orci.'; $title = array('Car Repairing', 'Vehicle Servicing', 'Car Finance'); $automobile_car_services_meta_1 = array('fas fa-car', 'fas fa-cog', 'fas fa-wrench'); // Create post object $automobile_car_services_my_post = array( 'post_title' => wp_strip_all_tags($title[$i - 1]), 'post_content' => $automobile_car_services_content, 'post_status' => 'publish', 'post_type' => 'post', 'post_category' => array($automobile_car_services_latest_post_category) ); // Insert the post into the database and get its ID $automobile_car_services_post_id = wp_insert_post($automobile_car_services_my_post); // Now that the post is created, update its meta if ($automobile_car_services_post_id) { $icon_class = $automobile_car_services_meta_1[$i - 1]; update_post_meta($automobile_car_services_post_id, 'automobile_car_services_icon', "( $icon_class )"); } } //--------------------------------------// } } // Instantiate the class and call its methods $demo_importer = new AutomobileCarServicesDemoImporter(); $demo_importer->setup_widgets(); $demo_importer->automobile_car_services_customizer_primary_menu(); } ?>