__('Home', 'automobile-rental'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url('/'), 'menu-item-status' => 'publish', )); wp_update_nav_menu_item($automobile_rental_menu_id, 0, array( 'menu-item-title' => __('Services','automobile-rental'), 'menu-item-classes' => 'services', 'menu-item-url' => get_permalink(automobile_rental_get_page_id_by_title('services')), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($automobile_rental_menu_id, 0, array( 'menu-item-title' => __('About Us','automobile-rental'), 'menu-item-classes' => 'about', 'menu-item-url' => get_permalink(automobile_rental_get_page_id_by_title('about')), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($automobile_rental_menu_id, 0, array( 'menu-item-title' => __('Cars','automobile-rental'), 'menu-item-classes' => 'cars', 'menu-item-url' => get_permalink(automobile_rental_get_page_id_by_title('cars')), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($automobile_rental_menu_id, 0, array( 'menu-item-title' => __('Blogs','automobile-rental'), 'menu-item-classes' => 'blogs', 'menu-item-url' => get_permalink(automobile_rental_get_page_id_by_title('blogs')), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($automobile_rental_menu_id, 0, array( 'menu-item-title' => __('Shop','automobile-rental'), 'menu-item-classes' => 'shop', 'menu-item-url' => get_permalink(automobile_rental_get_page_id_by_title('shop')), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($automobile_rental_menu_id, 0, array( 'menu-item-title' => __('Contact Us','automobile-rental'), 'menu-item-classes' => 'contact', 'menu-item-url' => get_permalink(automobile_rental_get_page_id_by_title('contact')), 'menu-item-status' => 'publish')); wp_update_nav_menu_item($automobile_rental_menu_id, 0, array( 'menu-item-title' => __('Gifting','automobile-rental'), 'menu-item-classes' => 'gifting', 'menu-item-url' => get_permalink(automobile_rental_get_page_id_by_title('gifting')), 'menu-item-status' => 'publish')); if (!has_nav_menu($automobile_rental_bpmenulocation)) { $locations = get_theme_mod('nav_menu_locations'); $locations[$automobile_rental_bpmenulocation] = $automobile_rental_menu_id; set_theme_mod('nav_menu_locations', $locations); } } } public function setup_widgets() { $automobile_rental_home_id=''; $automobile_rental_home_content = ''; $automobile_rental_home_title = 'Home'; $automobile_rental_home = array( 'post_type' => 'page', 'post_title' => $automobile_rental_home_title, 'post_content' => $automobile_rental_home_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'home' ); $automobile_rental_home_id = wp_insert_post($automobile_rental_home); add_post_meta( $automobile_rental_home_id, '_wp_page_template', 'frontpage.php' ); update_option( 'page_on_front', $automobile_rental_home_id ); update_option( 'show_on_front', 'page' ); // Create a Posts Page $automobile_rental_blog_title = 'Products'; $automobile_rental_blog_check = automobile_rental_get_page_id_by_title($automobile_rental_blog_title); if ($automobile_rental_blog_check == 1) { $automobile_rental_blog = array( 'post_type' => 'page', 'post_title' => $automobile_rental_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'products', '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_rental_blog_id = wp_insert_post($automobile_rental_blog); if (!is_wp_error($automobile_rental_blog_id)) { // update_option('page_for_posts', $automobile_rental_blog_id); } } // Create a Posts Page $automobile_rental_blog_title = 'Services'; $automobile_rental_blog_check = automobile_rental_get_page_id_by_title($automobile_rental_blog_title); if ($automobile_rental_blog_check == 1) { $automobile_rental_blog = array( 'post_type' => 'page', 'post_title' => $automobile_rental_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'services', '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_rental_blog_id = wp_insert_post($automobile_rental_blog); if (!is_wp_error($automobile_rental_blog_id)) { // update_option('page_for_posts', $automobile_rental_blog_id); } } // Create a Posts Page $automobile_rental_blog_title = 'Blogs'; $automobile_rental_blog_check = automobile_rental_get_page_id_by_title($automobile_rental_blog_title); if ($automobile_rental_blog_check == 1) { $automobile_rental_blog = array( 'post_type' => 'page', 'post_title' => $automobile_rental_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'blogs', '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_rental_blog_id = wp_insert_post($automobile_rental_blog); if (!is_wp_error($automobile_rental_blog_id)) { // update_option('page_for_posts', $automobile_rental_blog_id); } } // Create a Posts Page $automobile_rental_blog_title = 'Contact Us'; $automobile_rental_blog_check = automobile_rental_get_page_id_by_title($automobile_rental_blog_title); if ($automobile_rental_blog_check == 1) { $automobile_rental_blog = array( 'post_type' => 'page', 'post_title' => $automobile_rental_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_rental_blog_id = wp_insert_post($automobile_rental_blog); if (!is_wp_error($automobile_rental_blog_id)) { // update_option('page_for_posts', $automobile_rental_blog_id); } } // Create a Posts Page $automobile_rental_blog_title = 'About Us'; $automobile_rental_blog_check = automobile_rental_get_page_id_by_title($automobile_rental_blog_title); if ($automobile_rental_blog_check == 1) { $automobile_rental_blog = array( 'post_type' => 'page', 'post_title' => $automobile_rental_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'about-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_rental_blog_id = wp_insert_post($automobile_rental_blog); if (!is_wp_error($automobile_rental_blog_id)) { // update_option('page_for_posts', $automobile_rental_blog_id); } } // Create a Posts Page $automobile_rental_blog_title = 'Cars'; $automobile_rental_blog_check = automobile_rental_get_page_id_by_title($automobile_rental_blog_title); if ($automobile_rental_blog_check == 1) { $automobile_rental_blog = array( 'post_type' => 'page', 'post_title' => $automobile_rental_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'cars', '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_rental_blog_id = wp_insert_post($automobile_rental_blog); if (!is_wp_error($automobile_rental_blog_id)) { // update_option('page_for_posts', $automobile_rental_blog_id); } } //-----Header -----// set_theme_mod( 'automobile_rental_header_inner_text', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ' ); set_theme_mod( 'automobile_rental_header_inner_emial', 'info@example.com' ); set_theme_mod( 'automobile_rental_header_inner_phone_number', '123456789' ); set_theme_mod( 'automobile_rental_header_newsletter_button_text', 'Rent A Car' ); set_theme_mod( 'automobile_rental_header_newsletter_button_url', '#' ); //-----Slider-----// set_theme_mod( 'automobile_rental_blog_box_enable', true); set_theme_mod( 'automobile_rental_blog_slide_number', '3' ); $automobile_rental_latest_post_category = wp_create_category('Slider Post'); set_theme_mod( 'automobile_rental_blog_slide_category', 'Slider Post' ); for($i=1; $i<=3; $i++) { $title = 'Rent All Types Of Cars At One Stop'; $content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. '; // Create post object $automobile_rental_my_post = array( 'post_title' => wp_strip_all_tags( $title ), 'post_content' => $content, 'post_status' => 'publish', 'post_type' => 'post', 'post_category' => array($automobile_rental_latest_post_category) ); // Insert the post into the database $automobile_rental_post_id = wp_insert_post( $automobile_rental_my_post ); $automobile_rental_image_url = get_template_directory_uri().'/assets/images/banner.png'; $automobile_rental_image_name= 'banner.png'; $automobile_rental_upload_dir = wp_upload_dir(); // Set upload folder $automobile_rental_image_data = file_get_contents($automobile_rental_image_url); // Get image data $automobile_rental_unique_file_name = wp_unique_filename( $automobile_rental_upload_dir['path'], $automobile_rental_image_name ); // Generate unique name $filename= basename( $automobile_rental_unique_file_name ); // Create image file name // Check folder permission and define file location if( wp_mkdir_p( $automobile_rental_upload_dir['path'] ) ) { $file = $automobile_rental_upload_dir['path'] . '/' . $filename; } else { $file = $automobile_rental_upload_dir['basedir'] . '/' . $filename; } 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_rental_image_data, FS_CHMOD_FILE ) ) { wp_die( 'Error saving file!' ); } $automobile_rental_wp_filetype = wp_check_filetype( $filename, null ); $automobile_rental_attachment = array( 'post_mime_type' => $automobile_rental_wp_filetype['type'], 'post_title' => sanitize_file_name( $filename ), 'post_content' => '', 'post_type' => 'post', 'post_status' => 'inherit' ); $automobile_rental_attach_id = wp_insert_attachment( $automobile_rental_attachment, $file, $automobile_rental_post_id ); require_once(ABSPATH . 'wp-admin/includes/image.php'); $automobile_rental_attach_data = wp_generate_attachment_metadata( $automobile_rental_attach_id, $file ); wp_update_attachment_metadata( $automobile_rental_attach_id, $automobile_rental_attach_data ); set_post_thumbnail( $automobile_rental_post_id, $automobile_rental_attach_id ); } //-----Categories-----// set_theme_mod( 'automobile_rental_testimonial_section_enable', true); set_theme_mod( 'automobile_rental_categories_section_heading', 'Rental Car Types'); set_theme_mod( 'automobile_rental_categories_section_one_word', 'Categories'); $automobile_rental_categories_post_category = wp_create_category('Categories Post'); set_theme_mod( 'automobile_rental_blog_categories_section_category', 'Categories Post' ); $cat_title = array('SUV','LUXURY CAR','SPORT CAR'); for($i=1; $i<=3; $i++) { $title = $cat_title[$i-1]; $content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. '; // Create post object $automobile_rental_my_post = array( 'post_title' => wp_strip_all_tags( $title ), 'post_content' => $content, 'post_status' => 'publish', 'post_type' => 'post', 'post_category' => array($automobile_rental_categories_post_category) ); // Insert the post into the database $automobile_rental_post_id = wp_insert_post( $automobile_rental_my_post ); $automobile_rental_image_url = get_template_directory_uri().'/assets/images/categori'.$i.'.png'; $automobile_rental_image_name= 'categori'.$i.'.png'; $automobile_rental_upload_dir = wp_upload_dir(); // Set upload folder $automobile_rental_image_data = file_get_contents($automobile_rental_image_url); // Get image data $automobile_rental_unique_file_name = wp_unique_filename( $automobile_rental_upload_dir['path'], $automobile_rental_image_name ); // Generate unique name $filename= basename( $automobile_rental_unique_file_name ); // Create image file name // Check folder permission and define file location if( wp_mkdir_p( $automobile_rental_upload_dir['path'] ) ) { $file = $automobile_rental_upload_dir['path'] . '/' . $filename; } else { $file = $automobile_rental_upload_dir['basedir'] . '/' . $filename; } 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_rental_image_data, FS_CHMOD_FILE ) ) { wp_die( 'Error saving file!' ); } $automobile_rental_wp_filetype = wp_check_filetype( $filename, null ); $automobile_rental_attachment = array( 'post_mime_type' => $automobile_rental_wp_filetype['type'], 'post_title' => sanitize_file_name( $filename ), 'post_content' => '', 'post_type' => 'post', 'post_status' => 'inherit' ); $automobile_rental_attach_id = wp_insert_attachment( $automobile_rental_attachment, $file, $automobile_rental_post_id ); require_once(ABSPATH . 'wp-admin/includes/image.php'); $automobile_rental_attach_data = wp_generate_attachment_metadata( $automobile_rental_attach_id, $file ); wp_update_attachment_metadata( $automobile_rental_attach_id, $automobile_rental_attach_data ); set_post_thumbnail( $automobile_rental_post_id, $automobile_rental_attach_id ); } // Appoinment form shortcode $cf7title = "Appoinment"; $cf7content = '[select Select-Car-Type class:Select class:Car class:Type "4 Seater Car" "6 Seater Car" "8 Seater Car"] [select Pick-Up-Location class:Pick class:Up class:Location "209 Clermont Ave" "Lon Hessel" "4201 Atlantic Ave" "6451 W Bell Rd"] [date Select-Time class:Select-Time min:2025-02-05 max:2025-02-26 "2025-01-30"] [date Select-Time class:Select-Time min:2025-02-05 max:2025-02-26 "2025-01-30"] [select Pick-Up-Location class:Pick class:Up class:Location "209 Clermont Ave" "Lon Hessel" "4201 Atlantic Ave" "6451 W Bell Rd"] [date Select-Time class:Select-Time min:2025-02-05 max:2025-02-26 "2025-01-30"] [submit "Rent Now"] -- This e-mail was sent from a contact form on [_site_title] ([_site_url]) [_site_admin_email] Reply-To: [your-email] 0 0 [_site_title] "[your-subject]" [_site_title] Message Body: [your-message] -- This e-mail was sent from a contact form on [_site_title] ([_site_url]) [your-email] Reply-To: [_site_admin_email] 0 0 Thank you for your message. It has been sent. There was an error trying to send your message. Please try again later. One or more fields have an error. Please check and try again. There was an error trying to send your message. Please try again later. You must accept the terms and conditions before sending your message. The field is required. The field is too long. The field is too short. There was an unknown error uploading the file. You are not allowed to upload files of this type. The file is too big. There was an error uploading the file.'; $cf7_post = array( 'post_title' => wp_strip_all_tags( $cf7title ), 'post_content' => $cf7content, 'post_status' => 'publish', 'post_type' => 'wpcf7_contact_form', ); // Insert the post into the database $cf7post_id = wp_insert_post( $cf7_post ); add_post_meta( $cf7post_id, "_form", '[select Select-Car-Type class:Select class:Car class:Type "4 Seater Car" "6 Seater Car" "8 Seater Car"] [select Pick-Up-Location class:Pick class:Up class:Location "209 Clermont Ave" "Lon Hessel" "4201 Atlantic Ave" "6451 W Bell Rd"] [date Select-Time class:Select-Time min:2025-02-05 max:2025-02-26 "2025-01-30"] [date Select-Time class:Select-Time min:2025-02-05 max:2025-02-26 "2025-01-30"] [select Pick-Up-Location class:Pick class:Up class:Location "209 Clermont Ave" "Lon Hessel" "4201 Atlantic Ave" "6451 W Bell Rd"] [date Select-Time class:Select-Time min:2025-02-05 max:2025-02-26 "2025-01-30"] [submit "Rent Now"] ' ); $cf7mail_data = array( 'subject' => '[_site_title] "[your-subject]"', 'sender' => '[_site_title] ', 'body' => 'From: [your-name] <[your-email]> Subject: [your-subject] Message Body: [your-message] -- This e-mail was sent from a contact form on [_site_title] ([_site_url])', 'recipient' => '[_site_admin_email]', 'additional_headers' => 'Reply-To: [your-email]', 'attachments' => '', 'use_html' => 0, 'exclude_blank' => 0 ); add_post_meta($cf7post_id, "_mail", $cf7mail_data); // Gets term object from Tree in the database. $cf7shortcode = '[contact-form-7 id="'.$cf7post_id.'" title="'.$cf7title.'"]'; set_theme_mod( 'automobile_rental_contact_form_shortcode',$cf7shortcode ); } } // Instantiate the class and call its methods $demo_importer = new AutomobileRentalDemoImporter(); $demo_importer->setup_widgets(); $demo_importer->automobile_rental_customizer_primary_menu(); } ?>