' . esc_html__('Your demo import has been completed successfully.', 'advance-it-company') . '
'; echo '' . esc_html__('VIEW SITE', 'advance-it-company') . ''; //end // Social Icons set_theme_mod( 'advance_it_company_facebook_url', '#' ); set_theme_mod( 'advance_it_company_twitter_url', '#' ); set_theme_mod( 'advance_it_company_linkedin_url', '#' ); set_theme_mod( 'advance_it_company_instagram_url', '#' ); set_theme_mod( 'advance_it_company_youtube_url', '#' ); // Topbar Section set_theme_mod( 'advance_it_company_phone', 'CALL US' ); set_theme_mod( 'advance_it_company_phone1', '123-456-7890' ); set_theme_mod( 'advance_it_company_mail', 'EMAIL' ); set_theme_mod( 'advance_it_company_mail1', 'support@example.com' ); set_theme_mod( 'advance_it_company_address', 'ADDRESS' ); set_theme_mod( 'advance_it_company_address1', '15, Edison Street, Baltimore' ); // Slider for($advance_it_company_i=1;$advance_it_company_i<=4;$advance_it_company_i++){ $advance_it_company_slider_title = 'LOREM IPSUM DOLOR SIT AMET CONSECTETUR ADIPISCING ELIT'; $advance_it_company_slider_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida.'; // Create post object $advance_it_company_my_post = array( 'post_title' => wp_strip_all_tags( $advance_it_company_slider_title ), 'post_content' => $advance_it_company_slider_content, 'post_status' => 'publish', 'post_type' => 'page', ); // Insert the post into the database $advance_it_company_post_id = wp_insert_post( $advance_it_company_my_post ); if ($advance_it_company_post_id) { // Set the theme mod for the slider page set_theme_mod('advance_it_company_slider_page' . $advance_it_company_i, $advance_it_company_post_id); $advance_it_company_image_url = get_template_directory_uri().'/images/slider'.$advance_it_company_i.'.png'; $advance_it_company_image_id = media_sideload_image($advance_it_company_image_url, $advance_it_company_post_id, null, 'id'); if (!is_wp_error($advance_it_company_image_id)) { // Set the downloaded image as the post's featured image set_post_thumbnail($advance_it_company_post_id, $advance_it_company_image_id); } } } // How it works Section set_theme_mod( 'advance_it_company_title', 'HOW IT WORKS' ); // Create Posts $advance_it_company_post_title = 'LOREM IPSUM DOLOR SIT AMET'; $advance_it_company_post_content = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod.'; // Define the image URL (update as needed) $advance_it_company_image_url = get_template_directory_uri() . '/images/post-image.png'; // Define the category name $advance_it_company_category_name = 'example-category'; // Replace with your desired category name // Check if the category exists, or create it $advance_it_company_existing_category = term_exists($advance_it_company_category_name, 'category'); if ($advance_it_company_existing_category && is_array($advance_it_company_existing_category)) { // Get the term ID of the existing category $advance_it_company_category_term_id = (int) $advance_it_company_existing_category['term_id']; } else { // Create the category if it doesn't exist $advance_it_company_new_category = wp_insert_term($advance_it_company_category_name, 'category'); if (!is_wp_error($advance_it_company_new_category)) { $advance_it_company_category_term_id = (int) $advance_it_company_new_category['term_id']; } else { // Log the error and stop if the category cannot be created error_log('Error creating category: ' . $advance_it_company_new_category->get_error_message()); return; } } // Create the post array $advance_it_company_my_post = array( 'post_title' => wp_strip_all_tags($advance_it_company_post_title), 'post_content' => $advance_it_company_post_content, 'post_status' => 'publish', 'post_type' => 'post', ); // Insert the post into the database $advance_it_company_post_id = wp_insert_post($advance_it_company_my_post); // Check if the post was created successfully if (!is_wp_error($advance_it_company_post_id)) { wp_set_post_categories($advance_it_company_post_id, array($advance_it_company_category_term_id)); $advance_it_company_image_id = media_sideload_image($advance_it_company_image_url, $advance_it_company_post_id, null, 'id'); if (!is_wp_error($advance_it_company_image_id)) { set_post_thumbnail($advance_it_company_post_id, $advance_it_company_image_id); } else { error_log('Error downloading image: ' . $advance_it_company_image_id->get_error_message()); } set_theme_mod('advance_it_company_setting', $advance_it_company_post_id); } else { error_log('Post creation failed: ' . $advance_it_company_post_id->get_error_message()); } // Post Category set_theme_mod( 'advance_it_company_works_category', 'category1' ); $advance_it_company_category_names = array('category1', 'category2', 'category3'); $advance_it_company_title_array = array( array("Title 1", "Title 2", "Title 3", "Title 4"), array("Title 1", "Title 2", "Title 3", "Title 4"), array("Title 1", "Title 2", "Title 3", "Title 4") ); foreach ($advance_it_company_category_names as $advance_it_company_index => $advance_it_company_category_name) { $advance_it_company_category_term_id = 0; $advance_it_company_existing_term = term_exists($advance_it_company_category_name, 'category'); if ($advance_it_company_existing_term && is_array($advance_it_company_existing_term)) { $advance_it_company_category_term_id = (int)$advance_it_company_existing_term['term_id']; } else { $advance_it_company_new_term = wp_insert_term($advance_it_company_category_name, 'category'); if (!is_wp_error($advance_it_company_new_term)) { $advance_it_company_category_term_id = (int)$advance_it_company_new_term['term_id']; } else { error_log('Error creating category: ' . $advance_it_company_new_term->get_error_message()); continue; } } if (!$advance_it_company_category_term_id) { error_log('Error: Could not retrieve or create a valid category term ID for ' . $advance_it_company_category_name); continue; } for ($advance_it_company_i = 0; $advance_it_company_i < 4; $advance_it_company_i++) { // Create post content $advance_it_company_post_title = $advance_it_company_title_array[$advance_it_company_index][$advance_it_company_i]; $advance_it_company_post_content = 'Lorem ipsum dolor sit amet consectetur adipiscing.'; // Create post object $advance_it_company_post_data = array( 'post_title' => wp_strip_all_tags($advance_it_company_post_title), 'post_content' => $advance_it_company_post_content, 'post_status' => 'publish', 'post_type' => 'post', ); $advance_it_company_post_id = wp_insert_post($advance_it_company_post_data); if (is_wp_error($advance_it_company_post_id)) { error_log('Error creating post: ' . $advance_it_company_post_id->get_error_message()); continue; } wp_set_post_categories($advance_it_company_post_id, array($advance_it_company_category_term_id)); $advance_it_company_image_url = get_template_directory_uri() . '/images/image' . ($advance_it_company_i + 1) . '.png'; $advance_it_company_image_id = media_sideload_image($advance_it_company_image_url, $advance_it_company_post_id, null, 'id'); if (is_wp_error($advance_it_company_image_id)) { // Log error and skip to the next post if image download fails error_log('Error downloading image: ' . $advance_it_company_image_id->get_error_message()); continue; } set_post_thumbnail($advance_it_company_post_id, $advance_it_company_image_id); } } //Copyright Text set_theme_mod( 'advance_it_company_footer_copy', 'By VWThemes' ); } ?>