<?php

function health_import_files() {
    
    add_filter( 'pt-ocdi/regenerate_thumbnails_in_content_import', '__return_false' );
    
    add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
    
    return array(
        
		array(
            'import_file_name'           => esc_html__( 'health Demo', 'health' ),
            'import_file_url'            => esc_url('http://assets.templines.com/import-demo/health/health.xml'),
            'import_widget_file_url'     => esc_url('http://assets.templines.com/import-demo/health/health.wie'),
            'import_customizer_file_url' => esc_url('http://assets.templines.com/import-demo/health/health.dat'),
            'import_preview_image_url'   => esc_url('http://assets.templines.com/import-demo/health/health.jpg'),
            'import_notice'              => '',
        ),

        
        
    );
}
add_filter( 'pt-ocdi/import_files', 'health_import_files' );


function health_after_import( $selected_import ) {

    $menu_arr = array();
    
    $main_menu = get_term_by('name', 'medical', 'nav_menu');
    $top_menu = get_term_by('name', 'top medical', 'nav_menu');
    

    
    if(is_object($main_menu)) {
    	$menu_arr['primary_nav'] = $main_menu->term_id;
    }
    if(is_object($top_menu)) {
    	$menu_arr['top_nav'] = $top_menu->term_id;
    }
    set_theme_mod( 'nav_menu_locations', $menu_arr );

   
     
    if ( 'health Demo' === $selected_import['import_file_name'] ) {
    	
        
         $slider_array = array(
        get_template_directory()."/library/revslider/home1.zip",
    );
        
    } 
    
    
    

    $front_page_id = get_page_by_title( 'Home' );
    $blog_page_id  = get_page_by_title( 'Blog' );
	
	
	

    update_option( 'show_on_front', 'page' );
    
    if ( 'health Demo' === $selected_import['import_file_name'] ) {
    	update_option( 'page_on_front', 14786 );
    } 
    
    
    
    
        
   
    

    $absolute_path = __FILE__;
    $path_to_file = explode( 'wp-content', $absolute_path );
    $path_to_wp = $path_to_file[0];

    require_once( $path_to_wp.'/wp-load.php' );
    require_once( $path_to_wp.'/wp-includes/functions.php');

    $slider = new RevSlider();

    foreach($slider_array as $filepath){
     $slider->importSliderFromPost(true,true,$filepath);
    }
	
	update_post_meta($blog_page_id->ID,'pix_selected_sidebar','sidebar-1');

}
add_action( 'pt-ocdi/after_import', 'health_after_import' );

?>