set_vars( $business_revolution_config );
$this->init();
}
/**
* Set some settings
* @since 1.0.0
* @param $business_revolution_config Our config parameters
*/
public function set_vars( $business_revolution_config ) {
if( isset( $business_revolution_config['page_slug'] ) ) {
$this->page_slug = esc_attr( $business_revolution_config['page_slug'] );
}
if( isset( $business_revolution_config['page_title'] ) ) {
$this->page_title = esc_attr( $business_revolution_config['page_title'] );
}
if( isset( $business_revolution_config['steps'] ) ) {
$this->config_steps = $business_revolution_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',
'business_revolution_whizzie_params',
array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'wpnonce' => wp_create_nonce( 'whizzie_nonce' ),
'verify_text' => esc_html( 'verifying', 'business-revolution' )
)
);
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_revolution_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-revolution' ),
'icon' => 'welcome-widgets-menus',
'view' => 'get_step_widgets',
'callback' => 'install_widgets',
'button_text_one' => __( 'Import Demo', 'business-revolution' ),
'can_skip' => true,
'icon_text' => 'Import Demo'
),
'done' => array(
'id' => 'done',
'title' => __( 'All Done', 'business-revolution' ),
'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-revolution'),
'menu-item-classes' => 'home',
'menu-item-url' => home_url('/'),
'menu-item-status' => 'publish'
));
// About
$business_revolution_page_about = get_page_by_path('about');
if($business_revolution_page_about){
wp_update_nav_menu_item($business_revolution_menu_id, 0, array(
'menu-item-title' => __('About', 'business-revolution'),
'menu-item-classes' => 'about',
'menu-item-url' => get_permalink($business_revolution_page_about),
'menu-item-status' => 'publish'
));
}
// Services
$business_revolution_page_services = get_page_by_path('services');
if($business_revolution_page_services){
wp_update_nav_menu_item($business_revolution_menu_id, 0, array(
'menu-item-title' => __('Services', 'business-revolution'),
'menu-item-classes' => 'services',
'menu-item-url' => get_permalink($business_revolution_page_services),
'menu-item-status' => 'publish'
));
}
// Blog
$business_revolution_page_blog = get_page_by_path('blog');
if($business_revolution_page_blog){
wp_update_nav_menu_item($business_revolution_menu_id, 0, array(
'menu-item-title' => __('Blog', 'business-revolution'),
'menu-item-classes' => 'blog',
'menu-item-url' => get_permalink($business_revolution_page_blog),
'menu-item-status' => 'publish'
));
}
// Contact Us
$business_revolution_page_contact = get_page_by_path('contact');
if($business_revolution_page_contact){
wp_update_nav_menu_item($business_revolution_menu_id, 0, array(
'menu-item-title' => __('Contact Us', 'business-revolution'),
'menu-item-classes' => 'contact',
'menu-item-url' => get_permalink($business_revolution_page_contact),
'menu-item-status' => 'publish'
));
}
// Assign menu to location if not set
if (!has_nav_menu($business_revolution_menulocation)) {
$business_revolution_locations = get_theme_mod('nav_menu_locations');
$business_revolution_locations[$business_revolution_menulocation] = $business_revolution_menu_id; // Use $business_revolution_menu_id here
set_theme_mod('nav_menu_locations', $business_revolution_locations);
}
}
}
public function business_revolution_social_menu() {
// ------- Create Social Menu --------
$business_revolution_menuname = $business_revolution_themename . 'Social Menu';
$business_revolution_menulocation = 'social-menu';
$business_revolution_menu_exists = wp_get_nav_menu_object( $business_revolution_menuname );
if( !$business_revolution_menu_exists){
$business_revolution_menu_id = wp_create_nav_menu($business_revolution_menuname);
wp_update_nav_menu_item( $business_revolution_menu_id, 0, array(
'menu-item-title' => __( 'Facebook', 'business-revolution' ),
'menu-item-url' => 'https://www.facebook.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $business_revolution_menu_id, 0, array(
'menu-item-title' => __( 'Pinterest', 'business-revolution' ),
'menu-item-url' => 'https://www.pinterest.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $business_revolution_menu_id, 0, array(
'menu-item-title' => __( 'Twitter', 'business-revolution' ),
'menu-item-url' => 'https://www.twitter.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $business_revolution_menu_id, 0, array(
'menu-item-title' => __( 'Youtube', 'business-revolution' ),
'menu-item-url' => 'https://www.youtube.com',
'menu-item-status' => 'publish',
) );
wp_update_nav_menu_item( $business_revolution_menu_id, 0, array(
'menu-item-title' => __( 'Instagram', 'business-revolution' ),
'menu-item-url' => 'https://www.instagram.com',
'menu-item-status' => 'publish',
) );
if( !has_nav_menu( $business_revolution_menulocation ) ){
$locations = get_theme_mod('nav_menu_locations');
$locations[$business_revolution_menulocation] = $business_revolution_menu_id;
set_theme_mod( 'nav_menu_locations', $locations );
}
}
}
/**
* Imports the Demo Content
* @since 1.1.0
*/
public function setup_widgets() {
//................................................. MENU PAGES .................................................//
$business_revolution_home_id='';
$business_revolution_home_content = '';
$business_revolution_home_title = 'Home';
$business_revolution_home = array(
'post_type' => 'page',
'post_title' => $business_revolution_home_title,
'post_content' => $business_revolution_home_content,
'post_status' => 'publish',
'post_author' => 1,
'post_slug' => 'home'
);
$business_revolution_home_id = wp_insert_post($business_revolution_home);
//Set the home page template
add_post_meta( $business_revolution_home_id, '_wp_page_template', 'revolution-home.php' );
//Set the static front page
$business_revolution_home = get_page_by_title( 'Home' );
update_option( 'page_on_front', $business_revolution_home->ID );
update_option( 'show_on_front', 'page' );
// Create a posts page and assign the template
$business_revolution_blog_title = 'Blog';
$business_revolution_blog_check = get_page_by_path('blog');
if (!$business_revolution_blog_check) {
$business_revolution_blog = array(
'post_type' => 'page',
'post_title' => $business_revolution_blog_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'blog' // Unique slug for the blog page
);
$business_revolution_blog_id = wp_insert_post($business_revolution_blog);
// Set the posts page
if (!is_wp_error($business_revolution_blog_id)) {
update_option('page_for_posts', $business_revolution_blog_id);
}
}
// Create a Contact Us page and assign the template
$business_revolution_contact_title = 'Contact Us';
$business_revolution_contact_check = get_page_by_path('contact');
if (!$business_revolution_contact_check) {
$business_revolution_contact = array(
'post_type' => 'page',
'post_title' => $business_revolution_contact_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'contact' // Unique slug for the Contact Us page
);
wp_insert_post($business_revolution_contact);
}
// Create a About page and assign the template
$business_revolution_about_title = 'About';
$business_revolution_about_check = get_page_by_path('about');
if (!$business_revolution_about_check) {
$business_revolution_about = array(
'post_type' => 'page',
'post_title' => $business_revolution_about_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'about' // Unique slug for the About page
);
wp_insert_post($business_revolution_about);
}
// Create a Services page and assign the template
$business_revolution_services_title = 'Services';
$business_revolution_services_check = get_page_by_path('services');
if (!$business_revolution_services_check) {
$business_revolution_services = array(
'post_type' => 'page',
'post_title' => $business_revolution_services_title,
'post_status' => 'publish',
'post_author' => 1,
'post_name' => 'services' // Unique slug for the Services page
);
wp_insert_post($business_revolution_services);
}
// ------------------------------------------ Header -------------------------------------- //
set_theme_mod('business_revolution_header_info_address','Orlando, FL 32830, united States');
set_theme_mod('business_revolution_header_info_phone','+12345678901');
set_theme_mod('business_revolution_header_info_email','abdcefxyz@example.com');
set_theme_mod('business_revolution_header_button_text','Invest Now');
set_theme_mod('business_revolution_header_button_link','#');
set_theme_mod('business_revolution_header_info',1);
// ------------------------------------------ Slider Section -------------------------------------- //
for($i=1;$i<=3;$i++){
set_theme_mod( 'business_revolution_slider_image'.$i,get_template_directory_uri().'/revolution/assets/images/slider'.$i.'.png' );
set_theme_mod( 'business_revolution_slider_heading'.$i, 'WHERE GOOD INTENTIONS MEET SMART BUSINESS SOLUTIONS' );
set_theme_mod( 'business_revolution_slider_text'.$i, 'lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.maecenas eget leo suscipit.maecenas eget leo suscipit' );
set_theme_mod( 'business_revolution_slider_button1_text'.$i, 'Invest Now' );
set_theme_mod( 'business_revolution_slider_button1_link'.$i, '#' );
set_theme_mod( 'business_revolution_slider_button2_text'.$i, 'Raise Refund' );
set_theme_mod( 'business_revolution_slider_button2_link'.$i, '#' );
}
// ------------------------------------------ Chef Section -------------------------------------- //
set_theme_mod('business_revolution_event_heading','UPCOMING EVENTS');
set_theme_mod('business_revolution_event_text','Lorem ipsum is simply dummy text of the printing and typesetting industry, lorem ipsum has been the industry standard dummy text ever since the 1500s, when an unknown printer.');
$event_title=array('CORPORATE CONNECT CONFERENCE','INDUSTRY INSIGHTS CONVENTION');
for($i=1;$i<=2;$i++) {
set_theme_mod( 'business_revolution_category_image'.$i,get_template_directory_uri().'/revolution/assets/images/events'.$i.'.png' );
set_theme_mod( 'business_revolution_projetcs_text'.$i, $event_title[$i-1] );
set_theme_mod( 'business_revolution_category_text'.$i, 'Proin augue dui, sodales vel porttitor eu, mollis vel ligula. Sed eu tellus ipsum. Donec rutrum gravida lectus. Proin cursus maximus ante. Sed sodales ullamcorper' );
set_theme_mod( 'business_revolution_category_date_text'.$i, '29 Aug 2018' );
set_theme_mod( 'business_revolution_category_time'.$i, '5:00 PM' );
set_theme_mod( 'business_revolution_category_location_text'.$i, 'Bangkok, Thailand' );
set_theme_mod( 'business_revolution_category_button1_text'.$i, 'Enroll Now' );
set_theme_mod( 'business_revolution_category_button1_link'.$i, '#' );
}
set_theme_mod('business_revolution_category_main_button_text','View All Events');
set_theme_mod('business_revolution_category_main_button_link','#');
$this->business_revolution_customizer_nav_menu();
$this->business_revolution_social_menu();
}
public function business_revolution_guide() {
$display_string = '';
$return = add_query_arg( array()) ;
$theme = wp_get_theme( 'business-revolution' );
?>