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.
'; $bicycle_repair_shop_pages = array( 'post_type' => 'page', 'post_title' => $bicycle_repair_shop_pages_title, 'post_content' => $bicycle_repair_shop_pages_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'pages' ); $bicycle_repair_shop_pages_id = wp_insert_post($bicycle_repair_shop_pages); // Add Pages Page to Menu wp_update_nav_menu_item($bicycle_repair_shop_menu_id, 0, array( 'menu-item-title' => __('Pages', 'bicycle-repair-shop'), 'menu-item-classes' => 'pages', 'menu-item-url' => home_url('/pages/'), 'menu-item-status' => 'publish', 'menu-item-object-id' => $bicycle_repair_shop_pages_id, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type' )); // Create About Us Page with Dummy Content $bicycle_repair_shop_about_title = 'About Us'; $bicycle_repair_shop_about_content = '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.
'; $bicycle_repair_shop_about = array( 'post_type' => 'page', 'post_title' => $bicycle_repair_shop_about_title, 'post_content' => $bicycle_repair_shop_about_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'about-us' ); $bicycle_repair_shop_about_id = wp_insert_post($bicycle_repair_shop_about); // Add About Us Page to Menu wp_update_nav_menu_item($bicycle_repair_shop_menu_id, 0, array( 'menu-item-title' => __('About Us', 'bicycle-repair-shop'), 'menu-item-classes' => 'about-us', 'menu-item-url' => home_url('/about-us/'), 'menu-item-status' => 'publish', 'menu-item-object-id' => $bicycle_repair_shop_about_id, 'menu-item-object' => 'page', 'menu-item-type' => 'post_type' )); // Assign the menu to the primary location if not already set if ( ! has_nav_menu( $bicycle_repair_shop_bpmenulocation ) ) { $bicycle_repair_shop_locations = get_theme_mod( 'nav_menu_locations' ); if ( empty( $bicycle_repair_shop_locations ) ) { $bicycle_repair_shop_locations = array(); } $bicycle_repair_shop_locations[ $bicycle_repair_shop_bpmenulocation ] = $bicycle_repair_shop_menu_id; set_theme_mod( 'nav_menu_locations', $bicycle_repair_shop_locations ); } } //Logo set_theme_mod( 'bicycle_repair_shop_the_custom_logo', esc_url( get_template_directory_uri().'/images/Logo.png')); //Topbar set_theme_mod( 'bicycle_repair_shop_email_address', 'example@gmail.com'); set_theme_mod( 'bicycle_repair_shop_product_discount_text', 'GET 20% OFF ON SELECTED ITEMS'); set_theme_mod( 'bicycle_repair_shop_headerbutton_txt', 'SHOP NOW'); set_theme_mod( 'bicycle_repair_shop_headerbutton_link', '#'); //Slider Section set_theme_mod( 'bicycle_repair_shop_button_text', 'SHOP NOW'); set_theme_mod( 'bicycle_repair_shop_button_link_slider', '#'); $bicycle_repair_shop_featured_category_id = wp_create_category('Shop'); set_theme_mod('bicycle_repair_shop_slidersection', $bicycle_repair_shop_featured_category_id); $bicycle_repair_shop_titles = array( 'KEEPING YOU ON TRACK, ONE REPAIR AT A TIME.', 'YOUR TRUSTED PARTNER FOR SMOOTH RIDES.', 'RIDE WITHOUT LIMITS HIGH PERFORMANCE BICYCLES' ); $bicycle_repair_shop_content = 'Performance built to handle any terrain and riding style'; for ($bicycle_repair_shop_i = 0; $bicycle_repair_shop_i < 3; $bicycle_repair_shop_i++) { set_theme_mod('bicycle_repair_shop_title' . ($bicycle_repair_shop_i + 1), $bicycle_repair_shop_titles[$bicycle_repair_shop_i]); $bicycle_repair_shop_my_post = array( 'post_title' => wp_strip_all_tags($bicycle_repair_shop_titles[$bicycle_repair_shop_i]), 'post_content' => $bicycle_repair_shop_content, 'post_status' => 'publish', 'post_type' => 'post', 'post_category' => array($bicycle_repair_shop_featured_category_id), ); $bicycle_repair_shop_post_id = wp_insert_post($bicycle_repair_shop_my_post); if (!is_wp_error($bicycle_repair_shop_post_id)) { $bicycle_repair_shop_image_url = get_template_directory_uri() . '/images/slider-image' . ($bicycle_repair_shop_i + 1) . '.png'; $bicycle_repair_shop_image_id = media_sideload_image($bicycle_repair_shop_image_url, $bicycle_repair_shop_post_id, null, 'id'); if (!is_wp_error($bicycle_repair_shop_image_id)) { set_post_thumbnail($bicycle_repair_shop_post_id, $bicycle_repair_shop_image_id); } else { error_log('Failed to set post thumbnail for post ID: ' . $bicycle_repair_shop_post_id); } } else { error_log('Failed to create post: ' . print_r($bicycle_repair_shop_post_id, true)); } } //Selling Product Section set_theme_mod( 'bicycle_repair_shop_product_title', 'OUR MOST LOVED AND ADVANCED LINE-UP'); set_theme_mod( 'bicycle_repair_shop_product_text', 'Discover the latest collection of bike and enhance your style with unique and fantastic collection'); // Set the theme mod for the product category set_theme_mod('bicycle_repair_shop_hot_products_cat', 'productcategory1'); // Define the single product category name, product titles, and tags $bicycle_repair_shop_category_name = 'productcategory1'; $bicycle_repair_shop_titles = array( "Product Name Here", "Product Name Here", "Product Name Here", "Product Name Here" ); // Create or retrieve the product category term ID $bicycle_repair_shop_term = term_exists($bicycle_repair_shop_category_name, 'product_cat'); if (!$bicycle_repair_shop_term) { $bicycle_repair_shop_term = wp_insert_term($bicycle_repair_shop_category_name, 'product_cat'); } if (is_wp_error($bicycle_repair_shop_term)) { error_log('Error creating category: ' . $bicycle_repair_shop_term->get_error_message()); return; // Exit if category creation fails } $bicycle_repair_shop_term_id = is_array($bicycle_repair_shop_term) ? $bicycle_repair_shop_term['term_id'] : $bicycle_repair_shop_term; // Loop to create 4 products for the category foreach ($bicycle_repair_shop_titles as $index => $bicycle_repair_shop_title) { // Create product content $bicycle_repair_shop_content = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.'; // Create product post object $bicycle_repair_shop_post_id = wp_insert_post(array( 'post_title' => wp_strip_all_tags($bicycle_repair_shop_title), 'post_content' => $bicycle_repair_shop_content, 'post_status' => 'publish', 'post_type' => 'product', // Post type set to 'product' )); if (is_wp_error($bicycle_repair_shop_post_id)) { error_log('Error creating product: ' . $bicycle_repair_shop_post_id->get_error_message()); continue; // Skip to the next product if creation fails } // Assign the category to the product wp_set_object_terms($bicycle_repair_shop_post_id, $bicycle_repair_shop_term_id, 'product_cat'); // Set product price update_post_meta($bicycle_repair_shop_post_id, '_price', '1200.00'); // Set a price for the product // Handle the featured image using media_sideload_image $bicycle_repair_shop_image_url = get_template_directory_uri() . '/images/Product' . ($index + 1) . '.png'; $bicycle_repair_shop_image_id = media_sideload_image($bicycle_repair_shop_image_url, $bicycle_repair_shop_post_id, null, 'id'); if (!is_wp_error($bicycle_repair_shop_image_id)) { // Assign featured image to product set_post_thumbnail($bicycle_repair_shop_post_id, $bicycle_repair_shop_image_id); } else { error_log('Error downloading image for product: ' . $bicycle_repair_shop_image_id->get_error_message()); } } //Footer Copyright Text set_theme_mod( 'bicycle_repair_shop_copyright_line', 'Bicycle Repair Shop WordPress Theme' ); // Show success message and the "View Site" button echo '