set_vars( $bike_rental_services_config ); $this->init(); } /** * Set some settings * @since 1.0.0 * @param $bike_rental_services_config Our config parameters */ public function set_vars( $bike_rental_services_config ) { if( isset( $bike_rental_services_config['page_slug'] ) ) { $this->page_slug = esc_attr( $bike_rental_services_config['page_slug'] ); } if( isset( $bike_rental_services_config['page_title'] ) ) { $this->page_title = esc_attr( $bike_rental_services_config['page_title'] ); } if( isset( $bike_rental_services_config['steps'] ) ) { $this->config_steps = $bike_rental_services_config['steps']; } $current_theme = wp_get_theme(); $this->theme_title = $current_theme->get( 'Name' ); $this->theme_name = strtolower( preg_replace( '#[^a-zA-Z]#', '', $current_theme->get( 'Name' ) ) ); $this->page_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_page_slug', $this->theme_name . '-demoimport' ); $this->parent_slug = apply_filters( $this->theme_name . '_theme_setup_wizard_parent_slug', '' ); } /** * Hooks and filters * @since 1.0.0 */ public function init() { add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'admin_menu', array( $this, 'menu_page' ) ); add_action( 'wp_ajax_setup_widgets', array( $this, 'setup_widgets' ) ); } public function enqueue_scripts() { wp_enqueue_style( 'demo-import-style', get_template_directory_uri() . '/demo-import/assets/css/demo-import-style.css'); wp_register_script( 'demo-import-script', get_template_directory_uri() . '/demo-import/assets/js/demo-import-script.js', array( 'jquery' ), time() ); wp_localize_script( 'demo-import-script', 'bike_rental_services_whizzie_params', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'wpnonce' => wp_create_nonce( 'whizzie_nonce' ), 'verify_text' => esc_html( 'verifying', 'bike-rental-services' ) ) ); wp_enqueue_script( 'demo-import-script' ); } /** Make a modal screen for the wizard **/ public function menu_page() { add_menu_page( esc_html( $this->page_title ), esc_html( $this->page_title ), 'manage_options', $this->page_slug, array( $this, 'bike_rental_services_guide' ) ,'',40); } /** Make an interface for the wizard **/ public function wizard_page() { /* If we arrive here, we have the filesystem */ ?>
'; // The wizard is a list with only one item visible at a time $steps = $this->get_steps(); echo ''; echo ''; ?>
';?>
config_steps; $steps = array( 'widgets' => array( 'id' => 'widgets', 'title' => __( 'Customizer', 'bike-rental-services' ), 'icon' => 'welcome-widgets-menus', 'view' => 'get_step_widgets', 'callback' => 'install_widgets', 'button_text_one' => __( 'Import Demo', 'bike-rental-services' ), 'can_skip' => true, 'icon_text' => 'Import Demo' ), 'done' => array( 'id' => 'done', 'title' => __( 'All Done', 'bike-rental-services' ), 'icon' => 'yes', 'view' => 'get_step_done', 'callback' => '', 'icon_text' => 'Done' ) ); // Iterate through each step and replace with dev config values if( $dev_steps ) { // Configurable elements - these are the only ones the dev can update from config.php $can_config = array( 'title', 'icon', 'button_text', 'can_skip' ); foreach( $dev_steps as $dev_step ) { // We can only proceed if an ID exists and matches one of our IDs if( isset( $dev_step['id'] ) ) { $id = $dev_step['id']; if( isset( $steps[$id] ) ) { foreach( $can_config as $element ) { if( isset( $dev_step[$element] ) ) { $steps[$id][$element] = $dev_step[$element]; } } } } } } return $steps; } /** Print the content for the intro step **/ public function get_step_importer() { ?>

__('Home', 'bike-rental-services'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url('/'), 'menu-item-status' => 'publish' )); // About $bike_rental_services_page_about = get_page_by_path('about'); if($bike_rental_services_page_about){ wp_update_nav_menu_item($bike_rental_services_menu_id, 0, array( 'menu-item-title' => __('About', 'bike-rental-services'), 'menu-item-classes' => 'about', 'menu-item-url' => get_permalink($bike_rental_services_page_about), 'menu-item-status' => 'publish' )); } // Services $bike_rental_services_page_services = get_page_by_path('services'); if($bike_rental_services_page_services){ wp_update_nav_menu_item($bike_rental_services_menu_id, 0, array( 'menu-item-title' => __('Services', 'bike-rental-services'), 'menu-item-classes' => 'services', 'menu-item-url' => get_permalink($bike_rental_services_page_services), 'menu-item-status' => 'publish' )); } // Blog $bike_rental_services_page_blog = get_page_by_path('blog'); if($bike_rental_services_page_blog){ wp_update_nav_menu_item($bike_rental_services_menu_id, 0, array( 'menu-item-title' => __('Blog', 'bike-rental-services'), 'menu-item-classes' => 'blog', 'menu-item-url' => get_permalink($bike_rental_services_page_blog), 'menu-item-status' => 'publish' )); } // Contact Us $bike_rental_services_page_contact = get_page_by_path('contact'); if($bike_rental_services_page_contact){ wp_update_nav_menu_item($bike_rental_services_menu_id, 0, array( 'menu-item-title' => __('Contact Us', 'bike-rental-services'), 'menu-item-classes' => 'contact', 'menu-item-url' => get_permalink($bike_rental_services_page_contact), 'menu-item-status' => 'publish' )); } // Assign menu to location if not set if (!has_nav_menu($bike_rental_services_menulocation)) { $bike_rental_services_locations = get_theme_mod('nav_menu_locations'); $bike_rental_services_locations[$bike_rental_services_menulocation] = $bike_rental_services_menu_id; // Use $bike_rental_services_menu_id here set_theme_mod('nav_menu_locations', $bike_rental_services_locations); } } } public function bike_rental_services_social_menu() { // ------- Create Social Menu -------- $bike_rental_services_menuname = $bike_rental_services_themename . 'Social Menu'; $bike_rental_services_menulocation = 'social-menu'; $bike_rental_services_menu_exists = wp_get_nav_menu_object( $bike_rental_services_menuname ); if( !$bike_rental_services_menu_exists){ $bike_rental_services_menu_id = wp_create_nav_menu($bike_rental_services_menuname); wp_update_nav_menu_item( $bike_rental_services_menu_id, 0, array( 'menu-item-title' => __( 'Facebook', 'bike-rental-services' ), 'menu-item-url' => 'https://www.facebook.com', 'menu-item-status' => 'publish', ) ); wp_update_nav_menu_item( $bike_rental_services_menu_id, 0, array( 'menu-item-title' => __( 'Pinterest', 'bike-rental-services' ), 'menu-item-url' => 'https://www.pinterest.com', 'menu-item-status' => 'publish', ) ); wp_update_nav_menu_item( $bike_rental_services_menu_id, 0, array( 'menu-item-title' => __( 'Twitter', 'bike-rental-services' ), 'menu-item-url' => 'https://www.twitter.com', 'menu-item-status' => 'publish', ) ); wp_update_nav_menu_item( $bike_rental_services_menu_id, 0, array( 'menu-item-title' => __( 'Youtube', 'bike-rental-services' ), 'menu-item-url' => 'https://www.youtube.com', 'menu-item-status' => 'publish', ) ); wp_update_nav_menu_item( $bike_rental_services_menu_id, 0, array( 'menu-item-title' => __( 'Instagram', 'bike-rental-services' ), 'menu-item-url' => 'https://www.instagram.com', 'menu-item-status' => 'publish', ) ); if( !has_nav_menu( $bike_rental_services_menulocation ) ){ $locations = get_theme_mod('nav_menu_locations'); $locations[$bike_rental_services_menulocation] = $bike_rental_services_menu_id; set_theme_mod( 'nav_menu_locations', $locations ); } } } /** * Imports the Demo Content * @since 1.1.0 */ public function setup_widgets() { //................................................. MENU PAGES .................................................// $bike_rental_services_home_id=''; $bike_rental_services_home_content = ''; $bike_rental_services_home_title = 'Home'; $bike_rental_services_home = array( 'post_type' => 'page', 'post_title' => $bike_rental_services_home_title, 'post_content' => $bike_rental_services_home_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'home' ); $bike_rental_services_home_id = wp_insert_post($bike_rental_services_home); //Set the home page template add_post_meta( $bike_rental_services_home_id, '_wp_page_template', 'revolution-home.php' ); //Set the static front page $bike_rental_services_home = get_page_by_title( 'Home' ); update_option( 'page_on_front', $bike_rental_services_home->ID ); update_option( 'show_on_front', 'page' ); // Create a posts page and assign the template $bike_rental_services_blog_title = 'Blog'; $bike_rental_services_blog_check = get_page_by_path('blog'); if (!$bike_rental_services_blog_check) { $bike_rental_services_blog = array( 'post_type' => 'page', 'post_title' => $bike_rental_services_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'blog' // Unique slug for the blog page ); $bike_rental_services_blog_id = wp_insert_post($bike_rental_services_blog); // Set the posts page if (!is_wp_error($bike_rental_services_blog_id)) { update_option('page_for_posts', $bike_rental_services_blog_id); } } // Create a Contact Us page and assign the template $bike_rental_services_contact_title = 'Contact Us'; $bike_rental_services_contact_check = get_page_by_path('contact'); if (!$bike_rental_services_contact_check) { $bike_rental_services_contact = array( 'post_type' => 'page', 'post_title' => $bike_rental_services_contact_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'contact' // Unique slug for the Contact Us page ); wp_insert_post($bike_rental_services_contact); } // Create a About page and assign the template $bike_rental_services_about_title = 'About'; $bike_rental_services_about_check = get_page_by_path('about'); if (!$bike_rental_services_about_check) { $bike_rental_services_about = array( 'post_type' => 'page', 'post_title' => $bike_rental_services_about_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'about' // Unique slug for the About page ); wp_insert_post($bike_rental_services_about); } // Create a Services page and assign the template $bike_rental_services_services_title = 'Services'; $bike_rental_services_services_check = get_page_by_path('services'); if (!$bike_rental_services_services_check) { $bike_rental_services_services = array( 'post_type' => 'page', 'post_title' => $bike_rental_services_services_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'services' // Unique slug for the Services page ); wp_insert_post($bike_rental_services_services); } // ------------------------------------------ Header -------------------------------------- // set_theme_mod('bike_rental_services_phone_number_text','PHONE'); set_theme_mod('bike_rental_services_phone_number_option','+00 123 456 7890'); set_theme_mod('bike_rental_services_mail_address_text','EMAIL'); set_theme_mod('bike_rental_services_mail_address_option','xyz123@example.com'); set_theme_mod('bike_rental_services_header_button_text','SELL YOUR CAR'); set_theme_mod('bike_rental_services_header_button_link','#'); // ------------------------------------------ Slider Section -------------------------------------- // for($i=1;$i<=3;$i++){ set_theme_mod( 'bike_rental_services_slider_image'.$i,get_template_directory_uri().'/revolution/assets/images/slider'.$i.'.png' ); set_theme_mod( 'bike_rental_services_slider_xtra_heading'.$i, 'FIND YOUR DREAM BIKE' ); set_theme_mod( 'bike_rental_services_slider_heading'.$i, 'ULTRAVIOLETTE F77' ); set_theme_mod( 'bike_rental_services_slider_text'.$i, 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.' ); set_theme_mod( 'bike_rental_services_slider_button1_text'.$i, 'LEARN MORE' ); set_theme_mod( 'bike_rental_services_slider_button1_link'.$i, '#' ); } // ------------------------------------------ Popular Section -------------------------------------- // set_theme_mod('bike_rental_services_feature_short_heading','Most Popular'); set_theme_mod('bike_rental_services_feature_heading','MOST POPULAR FEATURED BIKE SPECIAL OFFERS'); set_theme_mod('bike_rental_services_feature_bike_box_tab_count','6'); for($i=1;$i<=6;$i++) { set_theme_mod( 'bike_rental_services_feature_bike_image_tab'.$i,get_template_directory_uri().'/revolution/assets/images/bikes'.$i.'.png' ); set_theme_mod( 'bike_rental_services_feature_bike_box_heading_tab'.$i, 'APACHE RTR 200 4V' ); set_theme_mod( 'bike_rental_services_feature_bike_box_content_tab'.$i, 'Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled. Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled.' ); set_theme_mod( 'bike_rental_services_tab_button_text'.$i, 'LEARN MORE' ); set_theme_mod( 'bike_rental_services_tab_button_link'.$i, '#' ); } $this->bike_rental_services_customizer_nav_menu(); $this->bike_rental_services_social_menu(); } public function bike_rental_services_guide() { $display_string = ''; $return = add_query_arg( array()) ; $theme = wp_get_theme( 'bike-rental-services' ); ?>

Version:

wizard_page(); ?>