' . esc_html__('Your demo import has been completed successfully.', 'advance-automobile') . '
'; echo '' . esc_html__('VIEW SITE', 'advance-automobile') . ''; //end // Social Icons set_theme_mod( 'advance_automobile_facebook_url', '#' ); set_theme_mod( 'advance_automobile_twitter_url', '#' ); set_theme_mod( 'advance_automobile_youtube_url', '#' ); set_theme_mod( 'advance_automobile_linkedin_url', '#' ); // Topbar Section set_theme_mod( 'advance_automobile_mail1', 'support@example.com' ); set_theme_mod( 'advance_automobile_book1', 'BOOK NOW' ); set_theme_mod( 'advance_automobile_book', '#' ); // Contact details set_theme_mod( 'advance_automobile_address', 'Lorem Ipsum' ); set_theme_mod( 'advance_automobile_address1', '09 Lorem ipsum United Kingdom' ); set_theme_mod( 'advance_automobile_time', 'Lorem Ipsum' ); set_theme_mod( 'advance_automobile_time1', 'Monday - Friday: 7.30am - 5.30pm' ); set_theme_mod( 'advance_automobile_call', 'Lorem Ipsum' ); set_theme_mod( 'advance_automobile_call1', '+01234-5678-90 / +09876-543-21' ); // Slider for($advance_automobile_i=1;$advance_automobile_i<=4;$advance_automobile_i++){ $advance_automobile_slider_title = 'LOREM IPSUM IS SIMPLY DUMMY'; $advance_automobile_slider_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; // Create post object $advance_automobile_my_post = array( 'post_title' => wp_strip_all_tags( $advance_automobile_slider_title ), 'post_content' => $advance_automobile_slider_content, 'post_status' => 'publish', 'post_type' => 'page', ); // Insert the post into the database $advance_automobile_post_id = wp_insert_post( $advance_automobile_my_post ); if ($advance_automobile_post_id) { // Set the theme mod for the slider page set_theme_mod('advance_automobile_slider_page' . $advance_automobile_i, $advance_automobile_post_id); $advance_automobile_image_url = get_template_directory_uri().'/images/slider'.$advance_automobile_i.'.png'; $advance_automobile_image_id = media_sideload_image($advance_automobile_image_url, $advance_automobile_post_id, null, 'id'); if (!is_wp_error($advance_automobile_image_id)) { // Set the downloaded image as the post's featured image set_post_thumbnail($advance_automobile_post_id, $advance_automobile_image_id); } } } // How it works Section set_theme_mod( 'advance_automobile_our_services_title', 'Our Services' ); // Post Category set_theme_mod( 'advance_automobile_category3', 'category1' ); // Define post category names and post titles $advance_education_category_names = array('category1', 'category2', 'category3'); $advance_education_title_array = array( array("Service Title 1", "Service Title 2", "Service Title 3"), array("Service Title 1", "Service Title 2", "Service Title 3"), array("Service Title 1", "Service Title 2", "Service Title 3") ); foreach ($advance_education_category_names as $advance_education_index => $advance_education_category_name) { // Create or retrieve the post category term ID $advance_education_term = term_exists($advance_education_category_name, 'category'); if ($advance_education_term === 0 || $advance_education_term === null) { // If the term does not exist, create it $advance_education_term = wp_insert_term($advance_education_category_name, 'category'); } if (is_wp_error($advance_education_term)) { error_log('Error creating category: ' . $advance_education_term->get_error_message()); continue; // Skip to the next iteration if category creation fails } for ($advance_education_i = 0; $advance_education_i < 3; $advance_education_i++) { // Create post content $advance_education_title = $advance_education_title_array[$advance_education_index][$advance_education_i]; $advance_education_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eius- mod 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 repre- henderit in voluptate.'; // Create post post object $advance_education_my_post = array( 'post_title' => wp_strip_all_tags($advance_education_title), 'post_content' => $advance_education_content, 'post_status' => 'publish', 'post_type' => 'post', // Post type set to 'post' ); // Insert the post into the database $advance_education_post_id = wp_insert_post($advance_education_my_post); if (is_wp_error($advance_education_post_id)) { error_log('Error creating post: ' . $advance_education_post_id->get_error_message()); continue; // Skip to the next post if creation fails } // Assign the category to the post wp_set_post_categories($advance_education_post_id, array((int)$advance_education_term['term_id'])); // Handle the featured image using media_sideload_image $advance_education_image_url = get_template_directory_uri() . '/images/image' . ($advance_education_i + 1) . '.png'; $advance_education_image_id = media_sideload_image($advance_education_image_url, $advance_education_post_id, null, 'id'); if (is_wp_error($advance_education_image_id)) { error_log('Error downloading image: ' . $advance_education_image_id->get_error_message()); continue; // Skip to the next post if image download fails } // Assign featured image to post set_post_thumbnail($advance_education_post_id, $advance_education_image_id); } } } ?>