set_vars( $business_development_coaching_config ); $this->init(); } /** * Set some settings * @since 1.0.0 * @param $business_development_coaching_config Our config parameters */ public function set_vars( $business_development_coaching_config ) { if( isset( $business_development_coaching_config['page_slug'] ) ) { $this->page_slug = esc_attr( $business_development_coaching_config['page_slug'] ); } if( isset( $business_development_coaching_config['page_title'] ) ) { $this->page_title = esc_attr( $business_development_coaching_config['page_title'] ); } if( isset( $business_development_coaching_config['steps'] ) ) { $this->config_steps = $business_development_coaching_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( 'after_switch_theme', array( $this, 'redirect_to_wizard' ) ); 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 redirect_to_wizard() { global $pagenow; if( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) && current_user_can( 'manage_options' ) ) { wp_redirect( admin_url( 'themes.php?page=' . esc_attr( $this->page_slug ) ) ); } } 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', 'business_development_coaching_whizzie_params', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'wpnonce' => wp_create_nonce( 'whizzie_nonce' ), 'verify_text' => esc_html( 'verifying', 'business-development-coaching' ) ) ); 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, 'business_development_coaching_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', 'business-development-coaching' ), 'icon' => 'welcome-widgets-menus', 'view' => 'get_step_widgets', 'callback' => 'install_widgets', 'button_text_one' => __( 'Import Demo', 'business-development-coaching' ), 'can_skip' => true, 'icon_text' => 'Import Demo' ), 'done' => array( 'id' => 'done', 'title' => __( 'All Done', 'business-development-coaching' ), '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', 'business-development-coaching'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url('/'), 'menu-item-status' => 'publish' )); // About $business_development_coaching_page_about = get_page_by_path('about'); if($business_development_coaching_page_about){ wp_update_nav_menu_item($business_development_coaching_menu_id, 0, array( 'menu-item-title' => __('About', 'business-development-coaching'), 'menu-item-classes' => 'about', 'menu-item-url' => get_permalink($business_development_coaching_page_about), 'menu-item-status' => 'publish' )); } // Services $business_development_coaching_page_services = get_page_by_path('services'); if($business_development_coaching_page_services){ wp_update_nav_menu_item($business_development_coaching_menu_id, 0, array( 'menu-item-title' => __('Services', 'business-development-coaching'), 'menu-item-classes' => 'services', 'menu-item-url' => get_permalink($business_development_coaching_page_services), 'menu-item-status' => 'publish' )); } // Blog $business_development_coaching_page_blog = get_page_by_path('blog'); if($business_development_coaching_page_blog){ wp_update_nav_menu_item($business_development_coaching_menu_id, 0, array( 'menu-item-title' => __('Blog', 'business-development-coaching'), 'menu-item-classes' => 'blog', 'menu-item-url' => get_permalink($business_development_coaching_page_blog), 'menu-item-status' => 'publish' )); } // Contact Us $business_development_coaching_page_contact = get_page_by_path('contact'); if($business_development_coaching_page_contact){ wp_update_nav_menu_item($business_development_coaching_menu_id, 0, array( 'menu-item-title' => __('Contact Us', 'business-development-coaching'), 'menu-item-classes' => 'contact', 'menu-item-url' => get_permalink($business_development_coaching_page_contact), 'menu-item-status' => 'publish' )); } // Assign menu to location if not set if (!has_nav_menu($business_development_coaching_menulocation)) { $business_development_coaching_locations = get_theme_mod('nav_menu_locations'); $business_development_coaching_locations[$business_development_coaching_menulocation] = $business_development_coaching_menu_id; // Use $business_development_coaching_menu_id here set_theme_mod('nav_menu_locations', $business_development_coaching_locations); } } } /** * Imports the Demo Content * @since 1.1.0 */ public function setup_widgets() { //................................................. MENU PAGES .................................................// $business_development_coaching_home_id=''; $business_development_coaching_home_content = ''; $business_development_coaching_home_title = 'Home'; $business_development_coaching_home = array( 'post_type' => 'page', 'post_title' => $business_development_coaching_home_title, 'post_content' => $business_development_coaching_home_content, 'post_status' => 'publish', 'post_author' => 1, 'post_slug' => 'home' ); $business_development_coaching_home_id = wp_insert_post($business_development_coaching_home); //Set the home page template add_post_meta( $business_development_coaching_home_id, '_wp_page_template', 'revolution-home.php' ); //Set the static front page $business_development_coaching_home = get_page_by_title( 'Home' ); update_option( 'page_on_front', $business_development_coaching_home->ID ); update_option( 'show_on_front', 'page' ); // Create a posts page and assign the template $business_development_coaching_blog_title = 'Blog'; $business_development_coaching_blog_check = get_page_by_path('blog'); if (!$business_development_coaching_blog_check) { $business_development_coaching_blog = array( 'post_type' => 'page', 'post_title' => $business_development_coaching_blog_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'blog' // Unique slug for the blog page ); $business_development_coaching_blog_id = wp_insert_post($business_development_coaching_blog); // Set the posts page if (!is_wp_error($business_development_coaching_blog_id)) { update_option('page_for_posts', $business_development_coaching_blog_id); } } // Create a Contact Us page and assign the template $business_development_coaching_contact_title = 'Contact Us'; $business_development_coaching_contact_check = get_page_by_path('contact'); if (!$business_development_coaching_contact_check) { $business_development_coaching_contact = array( 'post_type' => 'page', 'post_title' => $business_development_coaching_contact_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'contact' // Unique slug for the Contact Us page ); wp_insert_post($business_development_coaching_contact); } // Create a About page and assign the template $business_development_coaching_about_title = 'About'; $business_development_coaching_about_check = get_page_by_path('about'); if (!$business_development_coaching_about_check) { $business_development_coaching_about = array( 'post_type' => 'page', 'post_title' => $business_development_coaching_about_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'about' // Unique slug for the About page ); wp_insert_post($business_development_coaching_about); } // Create a Services page and assign the template $business_development_coaching_services_title = 'Services'; $business_development_coaching_services_check = get_page_by_path('services'); if (!$business_development_coaching_services_check) { $business_development_coaching_services = array( 'post_type' => 'page', 'post_title' => $business_development_coaching_services_title, 'post_status' => 'publish', 'post_author' => 1, 'post_name' => 'services' // Unique slug for the Services page ); wp_insert_post($business_development_coaching_services); } // ------------------------------------------ Header -------------------------------------- // set_theme_mod('business_development_coaching_topheader_text','ANY MAJOR ANNOUNCEMENT ABOUT YOUR BRAND OR ORGANIZATION GOES HERE!'); set_theme_mod('business_development_coaching_middle_header_contact_email','Mail: example.com'); set_theme_mod('business_development_coaching_middle_header_contact_phone','Phone: +12345678909'); set_theme_mod('business_development_coaching_middle_header_button_text','Get Free Consultation'); set_theme_mod('business_development_coaching_middle_header_button_link','#'); set_theme_mod('business_development_coaching_topheader_button_text','Get Free Life Coach Magazine!'); set_theme_mod('business_development_coaching_topheader_button_link','#'); // ------------------------------------------ Slider Section -------------------------------------- // for($i=1;$i<=3;$i++){ set_theme_mod( 'business_development_coaching_slider_image'.$i,get_template_directory_uri().'/revolution/assets/images/slider'.$i.'.png' ); set_theme_mod( 'business_development_coaching_slider_short_heading'.$i, 'Welcome to Business Developmemt Coaching WordPress Theme' ); set_theme_mod( 'business_development_coaching_slider_heading'.$i, 'We Help you live a Better Life!' ); set_theme_mod( 'business_development_coaching_slider_text'.$i, 'Aliquam malesuada bibendum arcu vitae elementum curabitur vitae ven pellentesque.' ); set_theme_mod( 'business_development_coaching_slider_button1_text'.$i, 'Get Started' ); set_theme_mod( 'business_development_coaching_slider_button1_link'.$i, '#' ); } // ------------------------------------------ Chef Section -------------------------------------- // set_theme_mod('business_development_coaching_event_heading','Our Exclusive Blog'); set_theme_mod('business_development_coaching_event_text','Our Articles & News'); set_theme_mod('business_development_coaching_blog_cat','uncategorized'); wp_delete_post(1); $blog_title=array('Our strategy create a low advantage','Our strategy create a low advantage','Our strategy create a low advantage'); for($i=1;$i<=3;$i++){ $title =$blog_title[$i-1]; $content = 'There are many variations of passages of Lorem Ipsum but the available'; // Create post object $my_post = array( 'post_title' => wp_strip_all_tags( $title ), 'post_content' => $content, 'post_status' => 'publish', 'post_type' => 'post', ); // Insert the post into the database $post_id = wp_insert_post( $my_post ); $image_url = get_template_directory_uri().'/revolution/assets/images/blogs'.$i.'.png'; $image_name= 'blogs'.$i.'.png'; $upload_dir = wp_upload_dir(); // Set upload folder $image_data = file_get_contents($image_url); // Get image data $unique_file_name = wp_unique_filename( $upload_dir['path'], $image_name ); // Generate unique name $filename= basename( $unique_file_name ); // Create image file name // Check folder permission and define file location if( wp_mkdir_p( $upload_dir['path'] ) ) { $file = $upload_dir['path'] . '/' . $filename; } else { $file = $upload_dir['basedir'] . '/' . $filename; } // Create the image file on the server if ( ! function_exists( 'WP_Filesystem' ) ) { require_once( ABSPATH . 'wp-admin/includes/file.php' ); } WP_Filesystem(); global $wp_filesystem; if ( ! $wp_filesystem->put_contents( $file, $image_data, FS_CHMOD_FILE ) ) { wp_die( 'Error saving file!' ); } // Check image file type $wp_filetype = wp_check_filetype( $filename, null ); // Set attachment data $attachment = array( 'post_mime_type' => $wp_filetype['type'], 'post_title' => sanitize_file_name( $filename ), 'post_content' => '', 'post_type' => 'post', 'post_status' => 'inherit' ); // Create the attachment $attach_id = wp_insert_attachment( $attachment, $file, $post_id ); // Include image.php require_once(ABSPATH . 'wp-admin/includes/image.php'); // Define attachment metadata $attach_data = wp_generate_attachment_metadata( $attach_id, $file ); // Assign metadata to attachment wp_update_attachment_metadata( $attach_id, $attach_data ); // And finally assign featured image to post set_post_thumbnail( $post_id, $attach_id ); } $this->business_development_coaching_customizer_nav_menu(); } public function business_development_coaching_guide() { $display_string = ''; $return = add_query_arg( array()) ; $theme = wp_get_theme( 'business-development-coaching' ); ?>

Version:

wizard_page(); ?>