' . esc_html__('Your demo import has been completed successfully.', 'advance-coaching') . '
'; echo '' . esc_html__('VIEW SITE', 'advance-coaching') . ''; //end // Topbar Section set_theme_mod( 'advance_coaching_time', 'Mon - Sat 9.00 - 19.00 Sunday CLOSED' ); set_theme_mod( 'advance_coaching_welcome_text', 'Welcome to Lorem ipsum dolor sit amet, consectetur elit.' ); set_theme_mod( 'advance_coaching_course1', 'REQUEST FREE COURSE' ); set_theme_mod( 'advance_coaching_course', '#' ); // Contact Section set_theme_mod( 'advance_coaching_mail', 'MAIL ADDRESS' ); set_theme_mod( 'advance_coaching_mail1', 'Coachingtsg@example.com' ); set_theme_mod( 'advance_coaching_phone', 'PHONE' ); set_theme_mod( 'advance_coaching_phone1', '00+1234567890' ); set_theme_mod( 'advance_coaching_address', 'ADDRESS' ); set_theme_mod( 'advance_coaching_address1', 'Ocean, Hilton Head Island,ORT, 1236' ); // Slider for($advance_coaching_i=1;$advance_coaching_i<=4;$advance_coaching_i++){ $advance_coaching_slider_title = 'LOREM IPSUM DOLOR LOREM IPSUM DOLOR SIT AMET'; $advance_coaching_slider_content = 'Lorem ipsum dolor sit amet, consectetur elit. Vestibulum nec odios Suspe ndisse cursus mal suada facilisis.'; // Create post object $advance_coaching_my_post = array( 'post_title' => wp_strip_all_tags( $advance_coaching_slider_title ), 'post_content' => $advance_coaching_slider_content, 'post_status' => 'publish', 'post_type' => 'page', ); // Insert the post into the database $advance_coaching_post_id = wp_insert_post( $advance_coaching_my_post ); if ($advance_coaching_post_id) { // Set the theme mod for the slider page set_theme_mod('advance_coaching_slider_page' . $advance_coaching_i, $advance_coaching_post_id); $advance_coaching_image_url = get_template_directory_uri().'/images/slider'.$advance_coaching_i.'.png'; $advance_coaching_image_id = media_sideload_image($advance_coaching_image_url, $advance_coaching_post_id, null, 'id'); if (!is_wp_error($advance_coaching_image_id)) { // Set the downloaded image as the post's featured image set_post_thumbnail($advance_coaching_post_id, $advance_coaching_image_id); } } } // Service Section set_theme_mod( 'advance_coaching_title', 'WELCOME TO OUR COACHING' ); // Post Category set_theme_mod( 'advance_coaching_projects_category_category', 'category1' ); // Define post category names and post titles $advance_coaching_category_names = array('category1', 'category2', 'category3'); $advance_coaching_title_array = array( array("COACHING ONLINE", "COACHING ONLINE", "COACHING ONLINE"), array("COACHING ONLINE", "COACHING ONLINE", "COACHING ONLINE"), array("COACHING ONLINE", "COACHING ONLINE", "COACHING ONLINE") ); foreach ($advance_coaching_category_names as $advance_coaching_index => $advance_coaching_category_name) { // Create or retrieve the post category term ID $advance_coaching_term = term_exists($advance_coaching_category_name, 'category'); if ($advance_coaching_term === 0 || $advance_coaching_term === null) { // If the term does not exist, create it $advance_coaching_term = wp_insert_term($advance_coaching_category_name, 'category'); } if (is_wp_error($advance_coaching_term)) { error_log('Error creating category: ' . $advance_coaching_term->get_error_message()); continue; // Skip to the next iteration if category creation fails } for ($advance_coaching_i = 0; $advance_coaching_i < 3; $advance_coaching_i++) { // Create post content $advance_coaching_title = $advance_coaching_title_array[$advance_coaching_index][$advance_coaching_i]; $advance_coaching_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit Etiam rhoncus elit aliquam facilisis pharetra.'; // Create post post object $advance_coaching_my_post = array( 'post_title' => wp_strip_all_tags($advance_coaching_title), 'post_content' => $advance_coaching_content, 'post_status' => 'publish', 'post_type' => 'post', // Post type set to 'post' ); // Insert the post into the database $advance_coaching_post_id = wp_insert_post($advance_coaching_my_post); if (is_wp_error($advance_coaching_post_id)) { error_log('Error creating post: ' . $advance_coaching_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_coaching_post_id, array((int)$advance_coaching_term['term_id'])); // Handle the featured image using media_sideload_image $advance_coaching_image_url = get_template_directory_uri() . '/images/image' . ($advance_coaching_i + 1) . '.png'; $advance_coaching_image_id = media_sideload_image($advance_coaching_image_url, $advance_coaching_post_id, null, 'id'); if (is_wp_error($advance_coaching_image_id)) { error_log('Error downloading image: ' . $advance_coaching_image_id->get_error_message()); continue; // Skip to the next post if image download fails } // Assign featured image to post set_post_thumbnail($advance_coaching_post_id, $advance_coaching_image_id); } } } ?>