' . esc_html__('Your demo import has been completed successfully.', 'anime-stream') . '

'; echo '' . esc_html__('View Site', 'anime-stream') . ''; echo ''. esc_html__( 'Customize Your Site', 'anime-stream' ) .''; echo ''. esc_html__( 'Free Theme Documentation', 'anime-stream' ) .''; } // POST and update the customizer and other related data if (isset($_POST['submit'])) { // Check if kk Star Ratings is installed and activated if (!is_plugin_active('kk-star-ratings/index.php')) { // Install the plugin if it doesn't exist $anime_stream_plugin_slug = 'kk-star-ratings'; $anime_stream_plugin_file = 'kk-star-ratings/index.php'; // Check if plugin is installed $anime_stream_installed_plugins = get_plugins(); if (!isset($anime_stream_installed_plugins[$anime_stream_plugin_file])) { include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); include_once(ABSPATH . 'wp-admin/includes/file.php'); include_once(ABSPATH . 'wp-admin/includes/misc.php'); include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); // Install the plugin $anime_stream_upgrader = new Plugin_Upgrader(); $anime_stream_upgrader->install('https://downloads.wordpress.org/plugin/kk-star-ratings.latest-stable.zip'); } // Activate the plugin activate_plugin($anime_stream_plugin_file); } // Check if CBX Bookmark & Favorite is installed and activated if (!is_plugin_active('cbxwpbookmark/cbxwpbookmark.php')) { // Install the plugin if it doesn't exist $anime_stream_plugin_slug = 'cbxwpbookmark'; $anime_stream_plugin_file = 'cbxwpbookmark/cbxwpbookmark.php'; // Check if plugin is installed $anime_stream_installed_plugins = get_plugins(); if (!isset($anime_stream_installed_plugins[$anime_stream_plugin_file])) { include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); include_once(ABSPATH . 'wp-admin/includes/file.php'); include_once(ABSPATH . 'wp-admin/includes/misc.php'); include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); // Install the plugin $anime_stream_upgrader = new Plugin_Upgrader(); $anime_stream_upgrader->install('https://downloads.wordpress.org/plugin/cbxwpbookmark.latest-stable.zip'); } // Activate the plugin activate_plugin($anime_stream_plugin_file); } // Check if ibtana visual editor is installed and activated if (!is_plugin_active('ibtana-visual-editor/plugin.php')) { // Install the plugin if it doesn't exist $anime_stream_plugin_slug = 'ibtana-visual-editor'; $anime_stream_plugin_file = 'ibtana-visual-editor/plugin.php'; // Check if plugin is installed $anime_stream_installed_plugins = get_plugins(); if (!isset($anime_stream_installed_plugins[$anime_stream_plugin_file])) { include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); include_once(ABSPATH . 'wp-admin/includes/file.php'); include_once(ABSPATH . 'wp-admin/includes/misc.php'); include_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); // Install the plugin $anime_stream_upgrader = new Plugin_Upgrader(); $anime_stream_upgrader->install('https://downloads.wordpress.org/plugin/ibtana-visual-editor.latest-stable.zip'); } // Activate the plugin activate_plugin($anime_stream_plugin_file); } // ------- Create Nav Menu -------- $anime_stream_menuname = 'Main Menus'; $anime_stream_bpmenulocation = 'primary'; $anime_stream_menu_exists = wp_get_nav_menu_object($anime_stream_menuname); if (!$anime_stream_menu_exists) { $anime_stream_menu_id = wp_create_nav_menu($anime_stream_menuname); // Create Home Page $anime_stream_home_title = 'Home'; $anime_stream_home = array( 'post_type' => 'page', 'post_title' => $anime_stream_home_title, 'post_content' => '', 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'home' ); $anime_stream_home_id = wp_insert_post($anime_stream_home); // Assign Home Page Template add_post_meta($anime_stream_home_id, '_wp_page_template', 'page-template/custom-home-page.php'); // Update options to set Home Page as the front page update_option('page_on_front', $anime_stream_home_id); update_option('show_on_front', 'page'); // Add Home Page to Menu wp_update_nav_menu_item($anime_stream_menu_id, 0, array( 'menu-item-title' => __('Home', 'anime-stream'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url('/'), 'menu-item-status' => 'publish', 'menu-item-object-id' => $anime_stream_home_id, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type' )); // Create Explore Page with Dummy Content $anime_stream_pages_title = 'Explore'; $anime_stream_pages_content = ' Explore all the pages we have on our website. Find information about our services, company, and more. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.'; $anime_stream_pages = array( 'post_type' => 'page', 'post_title' => $anime_stream_pages_title, 'post_content' => $anime_stream_pages_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'explore' ); $anime_stream_pages_id = wp_insert_post($anime_stream_pages); // Add Pages Page to Menu wp_update_nav_menu_item($anime_stream_menu_id, 0, array( 'menu-item-title' => __('Explore', 'anime-stream'), 'menu-item-classes' => 'explore', 'menu-item-url' => home_url('/explore/'), 'menu-item-status' => 'publish', 'menu-item-object-id' => $anime_stream_pages_id, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type' )); // Create About Us Page with Dummy Content $anime_stream_about_title = 'Genres'; $anime_stream_about_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...
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which dont look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isnt anything embarrassing hidden in the middle of text.
All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.'; $anime_stream_about = array( 'post_type' => 'page', 'post_title' => $anime_stream_about_title, 'post_content' => $anime_stream_about_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'genres' ); $anime_stream_about_id = wp_insert_post($anime_stream_about); // Add About Us Page to Menu wp_update_nav_menu_item($anime_stream_menu_id, 0, array( 'menu-item-title' => __('Genres', 'anime-stream'), 'menu-item-classes' => 'genres', 'menu-item-url' => home_url('/genres/'), 'menu-item-status' => 'publish', 'menu-item-object-id' => $anime_stream_about_id, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type' )); // Create Explore Page with Dummy Content $anime_stream_pages_title = 'Manga'; $anime_stream_pages_content = ' Explore all the pages we have on our website. Find information about our services, company, and more. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.'; $anime_stream_pages = array( 'post_type' => 'page', 'post_title' => $anime_stream_pages_title, 'post_content' => $anime_stream_pages_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'manga' ); $anime_stream_pages_id = wp_insert_post($anime_stream_pages); // Add Pages Page to Menu wp_update_nav_menu_item($anime_stream_menu_id, 0, array( 'menu-item-title' => __('Manga', 'anime-stream'), 'menu-item-classes' => 'manga', 'menu-item-url' => home_url('/manga/'), 'menu-item-status' => 'publish', 'menu-item-object-id' => $anime_stream_pages_id, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type' )); // Create Explore Page with Dummy Content $anime_stream_pages_title = 'Shop'; $anime_stream_pages_content = ' Explore all the pages we have on our website. Find information about our services, company, and more. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960 with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.'; $anime_stream_pages = array( 'post_type' => 'page', 'post_title' => $anime_stream_pages_title, 'post_content' => $anime_stream_pages_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'shop' ); $anime_stream_pages_id = wp_insert_post($anime_stream_pages); // Add Pages Page to Menu wp_update_nav_menu_item($anime_stream_menu_id, 0, array( 'menu-item-title' => __('Shop', 'anime-stream'), 'menu-item-classes' => 'shop', 'menu-item-url' => home_url('/shop/'), 'menu-item-status' => 'publish', 'menu-item-object-id' => $anime_stream_pages_id, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type' )); // Set the menu location if it's not already set if (!has_nav_menu($anime_stream_bpmenulocation)) { $anime_stream_locations = get_theme_mod('nav_menu_locations'); // Use 'nav_menu_locations' to get locations array if (empty($anime_stream_locations)) { $anime_stream_locations = array(); } $anime_stream_locations[$anime_stream_bpmenulocation] = $anime_stream_menu_id; set_theme_mod('nav_menu_locations', $anime_stream_locations); } } // Set the demo import completion flag update_option('anime_stream_demo_import_completed', true); // Display success message and "View Site" button echo '

' . esc_html__('Your demo import has been completed successfully.', 'anime-stream') . '

'; echo '' . esc_html__('View Site', 'anime-stream') . ''; echo ''. esc_html__( 'Customize Your Site', 'anime-stream' ) .''; echo ''. esc_html__( 'Free Theme Documentation', 'anime-stream' ) .''; //end // Header set_theme_mod( 'anime_stream_collection_button_text', 'My Collection' ); set_theme_mod( 'anime_stream_collection_button_url', '#' ); set_theme_mod( 'anime_stream_collection_button_icon', 'fa-solid fa-file' ); set_theme_mod( 'anime_stream_recent_button_text', 'Recents' ); set_theme_mod( 'anime_stream_recent_button_url', '#' ); set_theme_mod( 'anime_stream_recent_button_icon', 'fa-solid fa-clock' ); set_theme_mod( 'anime_stream_favourites_button_text', 'Favourites' ); set_theme_mod( 'anime_stream_favourites_button_url', '#' ); set_theme_mod( 'anime_stream_favourites_button_icon', 'fa-solid fa-star' ); set_theme_mod( 'anime_stream_sign_in_button_text', 'Sign In / Sign Up' ); set_theme_mod( 'anime_stream_sign_in_button_url', '#' ); set_theme_mod( 'anime_stream_sign_in_button_icon', 'fa-solid fa-user' ); // Create demo categories if not exist $anime_stream_demo_categories = array('Anime', 'Manga', 'Movies'); foreach ($anime_stream_demo_categories as $anime_stream_cat_name) { if (!term_exists($anime_stream_cat_name, 'category')) { wp_insert_term($anime_stream_cat_name, 'category'); } } // Set theme mod for customizer dropdowns set_theme_mod('anime_stream_header_top_category1', 'Anime'); set_theme_mod('anime_stream_header_top_category2', 'Manga'); set_theme_mod('anime_stream_header_top_category3', 'Movies'); // Slider set_theme_mod('anime_stream_slider_category', 'Project1'); $anime_stream_category_names = array('Project1', 'Project2'); $anime_stream_title_array = array( array("Dragon Ball Z: Battle of Gods", "Dragon Ball Z: Broly – The Legendary Super Saiyan", "Dragon Ball Z: Fusion Reborn"), array("Dragon Ball Z: Resurrection 'F'", "Dragon Ball Z: The Return of Cooler", "Dragon Ball Z: Wrath of the Dragon"), ); foreach ($anime_stream_category_names as $anime_stream_index => $anime_stream_category_name) { // Create or retrieve the category $anime_stream_term = term_exists($anime_stream_category_name, 'category'); if ($anime_stream_term === 0 || $anime_stream_term === null) { $anime_stream_term = wp_insert_term($anime_stream_category_name, 'category'); } if (is_wp_error($anime_stream_term)) { error_log('Error creating category: ' . $anime_stream_term->get_error_message()); continue; } for ($anime_stream_i = 0; $anime_stream_i < 3; $anime_stream_i++) { $anime_stream_title = $anime_stream_title_array[$anime_stream_index][$anime_stream_i]; // Use unique or common YouTube URLs $anime_stream_video_url = 'https://www.youtube.com/embed/9xwazD5SyVg'; // ✅ Embed video using iframe directly $anime_stream_content = '

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

'; $anime_stream_content .= '
'; // Create post array $anime_stream_my_post = array( 'post_title' => wp_strip_all_tags($anime_stream_title), 'post_content' => $anime_stream_content, 'post_status' => 'publish', 'post_type' => 'post', ); // Insert post $anime_stream_post_id = wp_insert_post($anime_stream_my_post); if (is_wp_error($anime_stream_post_id)) { error_log('Error creating post: ' . $anime_stream_post_id->get_error_message()); continue; } // Assign category wp_set_post_categories($anime_stream_post_id, array((int)$anime_stream_term['term_id'])); // Set featured image $anime_stream_image_url = get_template_directory_uri() . '/assets/images/slider' . ($anime_stream_i + 1) . '.png'; $anime_stream_image_id = media_sideload_image($anime_stream_image_url, $anime_stream_post_id, null, 'id'); if (!is_wp_error($anime_stream_image_id)) { set_post_thumbnail($anime_stream_post_id, $anime_stream_image_id); } else { error_log('Image error: ' . $anime_stream_image_id->get_error_message()); } } } // Top Charts set_theme_mod( 'anime_stream_chart_section_title', 'Top Charts' ); set_theme_mod('anime_stream_top_chart_category', 'Top Chart1'); // Define post category names and post titles $anime_stream_category_names = array('Top Chart1', 'Top Chart2'); $anime_stream_title_array = array( array("Demon Slayer", "Demon Slayer", "Demon Slayer"), array("Demon Slayer", "Demon Slayer", "Demon Slayer"), array("Demon Slayer", "Demon Slayer", "Demon Slayer"), ); foreach ($anime_stream_category_names as $anime_stream_index => $anime_stream_category_name) { // Create or retrieve the post category term ID $anime_stream_term = term_exists($anime_stream_category_name, 'category'); if ($anime_stream_term === 0 || $anime_stream_term === null) { // If the term does not exist, create it $anime_stream_term = wp_insert_term($anime_stream_category_name, 'category'); } if (is_wp_error($anime_stream_term)) { error_log('Error creating category: ' . $anime_stream_term->get_error_message()); continue; // Skip to the next iteration if category creation fails } for ($anime_stream_j = 0; $anime_stream_j < 3; $anime_stream_j++) { // Create post content $anime_stream_title = $anime_stream_title_array[$anime_stream_index][$anime_stream_j]; // Use unique or common YouTube URLs $anime_stream_video_url = 'https://www.youtube.com/embed/9xwazD5SyVg'; // ✅ Embed video using iframe directly $anime_stream_content = '

It is the Taisho Period in Japan. Tanjiro, a kindhearted boy who sells charcoal for a living, finds his family slaughtered by a demon. To make matters worse, his younger sister Nezuko, the sole survivor, has been transformed into a demon herself. Though devastated by this grim reality, Tanjiro resolves to become a “demon slayer” so that he can turn his sister back into a human, and kill the demon that massacred his family.

'; $anime_stream_content .= '
'; // Create post post object $anime_stream_my_post = array( 'post_title' => wp_strip_all_tags($anime_stream_title), 'post_content' => $anime_stream_content, 'post_status' => 'publish', 'post_type' => 'post', // Post type set to 'post' ); // Insert the post into the database $anime_stream_post_id = wp_insert_post($anime_stream_my_post); if (is_wp_error($anime_stream_post_id)) { error_log('Error creating post: ' . $anime_stream_post_id->get_error_message()); continue; // Skip to the next post if creation fails } // Assign the category to the post wp_set_post_categories($anime_stream_post_id, array((int)$anime_stream_term['term_id'])); // Handle the featured image using media_sideload_image $anime_stream_image_url = get_template_directory_uri() . '/assets/images/chart' . ($anime_stream_j + 1) . '.png'; $anime_stream_image_id = media_sideload_image($anime_stream_image_url, $anime_stream_post_id, null, 'id'); if (is_wp_error($anime_stream_image_id)) { error_log('Error downloading image: ' . $anime_stream_image_id->get_error_message()); continue; // Skip to the next post if image download fails } // Assign featured image to post set_post_thumbnail($anime_stream_post_id, $anime_stream_image_id); } } // Right Sidebar set_theme_mod( 'anime_stream_right_sidebar_hide_show', true ); set_theme_mod( 'anime_stream_right_top_cards_title', 'Top Charts' ); set_theme_mod( 'anime_stream_select_cards_number', '6' ); // select Post Box $anime_stream_title_array = array("Post title 1", "Post title 2", "Post title 3", "Post title 4", "Post title 5", "Post title 6"); for ($anime_stream_k = 1; $anime_stream_k <= 6; $anime_stream_k++) { set_theme_mod( 'anime_stream_add_card_text'.$anime_stream_k, '3.3k watching' ); // Create post $anime_stream_title = $anime_stream_title_array[$anime_stream_k - 1]; $anime_stream_content = 'Lorem Ipsum is simply dummy text of the printing and typesetting.'; $anime_stream_my_post = array( 'post_title' => wp_strip_all_tags($anime_stream_title), 'post_content' => $anime_stream_content, 'post_status' => 'publish', 'post_type' => 'post', ); $anime_stream_post_id = wp_insert_post($anime_stream_my_post); set_theme_mod('anime_stream_select_card_name' . $anime_stream_k, $anime_stream_post_id); // Get image URL $anime_stream_image_url = get_template_directory_uri() . '/assets/images/post' . $anime_stream_k . '.png'; $anime_stream_image_data = wp_remote_get($anime_stream_image_url); if (!is_wp_error($anime_stream_image_data)) { $anime_stream_image_body = wp_remote_retrieve_body($anime_stream_image_data); $anime_stream_upload_dir = wp_upload_dir(); $anime_stream_image_name = 'post' . $anime_stream_k . '.png'; $anime_stream_uploaded_file = wp_upload_bits($anime_stream_image_name, null, $anime_stream_image_body); if (!$anime_stream_uploaded_file['error']) { // Set attachment data $attachment = array( 'post_mime_type' => $anime_stream_uploaded_file['type'], 'post_title' => sanitize_file_name($anime_stream_image_name), 'post_content' => '', 'post_status' => 'inherit', ); $anime_stream_attach_id = wp_insert_attachment($attachment, $anime_stream_uploaded_file['file'], $anime_stream_post_id); require_once(ABSPATH . 'wp-admin/includes/image.php'); $anime_stream_attach_data = wp_generate_attachment_metadata($anime_stream_attach_id, $anime_stream_uploaded_file['file']); wp_update_attachment_metadata($anime_stream_attach_id, $anime_stream_attach_data); set_post_thumbnail($anime_stream_post_id, $anime_stream_attach_id); } } } // Right middle set_theme_mod( 'anime_stream_right_sidebar_title', 'Top Charts' ); for($anime_stream_image=1; $anime_stream_image<=3; $anime_stream_image++) { set_theme_mod( 'anime_stream_top_charts_slider_img'.$anime_stream_image, get_template_directory_uri().'/assets/images/right-img' . $anime_stream_image . '.png' ); } // right bottom set_theme_mod( 'anime_stream_right_sidebar_wallpaper_title', 'Wallpaper' ); for($anime_stream_k=1; $anime_stream_k<=3; $anime_stream_k++) { set_theme_mod( 'anime_stream_right_sidebar_wallpaper_img'.$anime_stream_k, get_template_directory_uri().'/assets/images/wallpaper-img' . $anime_stream_k . '.png' ); } set_theme_mod( 'anime_stream_gallery_button_text', 'Explore More' ); set_theme_mod( 'anime_stream_gallery_button_url', '#' ); } ?>