<?php

/* Idyllic Theme */

function idyllic_import_files() {
		return array(
    array(
      'import_file_name'             => 'Default Demo Content',
      'categories'                   => array( 'Default'),
      'local_import_file'            => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/default/idyllic.wordpress.xml',
      'local_import_widget_file'     => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/default/idyllic-widgets.wie',
      'local_import_customizer_file' => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/default/idyllic-export.dat',
      'import_preview_image_url'   	 => 'https://themefreesia.com/wp-content/uploads/2017/08/idyllic-screenshot.jpg',
      'import_notice'                => __( 'Important: You have to set up slider from Customize > Slider Options > Select Category Slider.<br> Portfolio from Customize > Front Page Template > Portfolio Section <br> Latest From Blog from Customize > Front Page Template > Latest From Blog Section <br> Recommended Plugins: Install WooCommerce , Recent Posts Widget With Thumbnails and Contact Form 7 Plugins  to look exactly as in our demo. <br> <br> Thanks for being part of us. If you really like our theme, Please help us <a href="https://wordpress.org/support/theme/idyllic/reviews/" target="_blank" rel="nofollow">rating</a> our theme
      	', 'theme-freesia-demo-import' ),
       'preview_url'                  => 'https://demo.themefreesia.com/idyllic/',
    ),
    array(
      'import_file_name'             => 'Idyllic Fashion',
      'categories'                   => array( 'Fashion' ),
      'local_import_file'            => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/fashion/idyllic-fashion.xml',
      'local_import_widget_file'     => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/fashion/idyllic-fashion-widgets.wie',
      'local_import_customizer_file' => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/fashion/idyllic-fashion-export.dat',
      'import_preview_image_url'   	 => 'https://themefreesia.com/wp-content/uploads/2017/03/idyllic-demo-screenshot-2.jpg',
      'import_notice'                => __( 'Important: You have to set up slider from Customize > Slider Options > Select Category Slider.<br> Portfolio from Customize > Front Page Template > Portfolio Section <br> Latest From Blog from Customize > Front Page Template > Latest From Blog Section <br> Recommended Plugins: Install WooCommerce , Recent Posts Widget With Thumbnails and Contact Form 7 Plugins  to look exactly as in our demo. <br> <br> Thanks for being part of us. If you really like our theme, Please help us <a href="https://wordpress.org/support/theme/idyllic/reviews/" target="_blank" rel="nofollow">rating</a> our theme
      	', 'theme-freesia-demo-import' ),
       'preview_url'                  => 'https://demo.themefreesia.com/idyllic-fashion/',
    ),
    array(
      'import_file_name'             => 'Idyllic Interior Architecture',
      'categories'                   => array( 'Interior Architecture' ),
      'local_import_file'            => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/interior-architecture/idyllic-interior-architecture.xml',
      'local_import_widget_file'     => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/interior-architecture/idyllic-interior-architecture-widgets.wie',
      'local_import_customizer_file' => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/interior-architecture/idyllic-interior-architecture-export.dat',
      'import_preview_image_url'   	 => 'https://themefreesia.com/wp-content/uploads/2017/03/idyllic-demo-screenshot-1.jpg',
      'import_notice'                => __( 'Important: You have to set up slider from Customize > Slider Options > Select Category Slider.<br> Portfolio from Customize > Front Page Template > Portfolio Section <br> Latest From Blog from Customize > Front Page Template > Latest From Blog Section <br> Recommended Plugins: Install WooCommerce , Recent Posts Widget With Thumbnails and Contact Form 7 Plugins  to look exactly as in our demo. <br> <br> Thanks for being part of us. If you really like our theme, Please help us <a href="https://wordpress.org/support/theme/idyllic/reviews/" target="_blank" rel="nofollow">rating</a> our theme
      	', 'theme-freesia-demo-import' ),
       'preview_url'                  => 'https://demo.themefreesia.com/idyllic-interior-architecture/',
    ),
    array(
      'import_file_name'             => 'Idyllic Creative Agency',
      'categories'                   => array( 'Creative Agency' ),
      'local_import_file'            => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/creative-agency/idyllic-creative-agency.xml',
      'local_import_widget_file'     => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/creative-agency/idyllic-creative-agency-widgets.wie',
      'local_import_customizer_file' => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/creative-agency/idyllic-creative-agency-export.dat',
      'import_preview_image_url'   	 => 'https://themefreesia.com/wp-content/uploads/2017/03/idyllic-demo-screenshot-4.jpg',
      'import_notice'                => __( 'Important: You have to set up slider from Customize > Slider Options > Select Category Slider.<br> Portfolio from Customize > Front Page Template > Portfolio Section <br> Latest From Blog from Customize > Front Page Template > Latest From Blog Section <br> Recommended Plugins: Install WooCommerce , Recent Posts Widget With Thumbnails and Contact Form 7 Plugins  to look exactly as in our demo. <br> <br> Thanks for being part of us. If you really like our theme, Please help us <a href="https://wordpress.org/support/theme/idyllic/reviews/" target="_blank" rel="nofollow">rating</a> our theme
      	', 'theme-freesia-demo-import' ),
       'preview_url'                  => 'https://demo.themefreesia.com/idyllic-creative-agency/',
    ),
    array(
      'import_file_name'             => 'Idyllic Non Profit',
      'categories'                   => array( 'Non Profit' ),
      'local_import_file'            => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/non-profit/idyllic-non-profit.xml',
      'local_import_widget_file'     => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/non-profit/idyllic-non-profit-widgets.wie',
      'local_import_customizer_file' => trailingslashit( plugin_dir_path( __FILE__ ) ).'dummy/idyllic/non-profit/idyllic-non-profit-export.dat',
      'import_preview_image_url'   	 => 'https://themefreesia.com/wp-content/uploads/2017/03/idyllic-demo-screenshot-3.jpg',
      'import_notice'                => __( 'Important: You have to set up slider from Customize > Slider Options > Select Category Slider.<br> Portfolio from Customize > Front Page Template > Portfolio Section <br> Latest From Blog from Customize > Front Page Template > Latest From Blog Section <br> Recommended Plugins: Install WooCommerce , Recent Posts Widget With Thumbnails and Contact Form 7 Plugins  to look exactly as in our demo. <br> <br> Thanks for being part of us. If you really like our theme, Please help us <a href="https://wordpress.org/support/theme/idyllic/reviews/" target="_blank" rel="nofollow">rating</a> our theme
      	', 'theme-freesia-demo-import' ),
       'preview_url'                  => 'https://demo.themefreesia.com/idyllic-non-profit/',
    ),
    array(
      'import_file_name'             => 'Idyllic Plus',
      'categories'                   => array( 'Idyllic Plus' ),
      'import_preview_image_url'     => 'https://themefreesia.com/wp-content/uploads/2017/10/idyllic-plus-screenshot.jpg',
      'preview_url'                  => 'https://demo.themefreesia.com/idyllic-plus/',
      'isPlus'                      => true,
      'buy_url'                    => 'https://themefreesia.com/plugins/idyllic-plus/'
    ),
  ); 
	  
}
add_filter( 'tf-tfdi/import_files', 'idyllic_import_files' );

function idyllic_after_import_setup($selected_import) {
  if ( 'Default Demo Content' === $selected_import['import_file_name'] ) {
    // Assign menus to their locations.
    $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
    $side_menu = get_term_by( 'name', 'Side menu', 'nav_menu' );
    $footer_menu = get_term_by( 'name', 'Footer menu', 'nav_menu' );
    $social_link = get_term_by( 'name', 'Social Icon', 'nav_menu' );

    set_theme_mod( 'nav_menu_locations', array(
        'primary' => $main_menu->term_id,
        'side-nav-menu' => $side_menu->term_id,
        'footermenu' => $footer_menu->term_id,
        'social-link' => $social_link->term_id,
      )
    );

    // Assign front page and posts page (blog page).
    $front_page_id = get_page_by_title( 'Home' );
    $blog_page_id  = get_page_by_title( 'Blog' );

    update_option( 'show_on_front', 'page' );
    update_option( 'page_on_front', $front_page_id->ID );
    update_option( 'page_for_posts', $blog_page_id->ID );
  } elseif('Idyllic Fashion' === $selected_import['import_file_name'] ){
    // Assign menus to their locations.
    $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
    $side_menu = get_term_by( 'name', 'Side Menu', 'nav_menu' );
    $footer_menu = get_term_by( 'name', 'Footer Menu', 'nav_menu' );
    $social_link = get_term_by( 'name', 'Add Social Icons Only', 'nav_menu' );

    set_theme_mod( 'nav_menu_locations', array(
        'primary' => $main_menu->term_id,
        'side-nav-menu' => $side_menu->term_id,
        'footermenu' => $footer_menu->term_id,
        'social-link' => $social_link->term_id,
      )
    );
    // Assign front page and posts page (blog page).
    $front_page_id = get_page_by_title( 'Home' );
    $blog_page_id  = get_page_by_title( 'Blog' );

    update_option( 'show_on_front', 'page' );
    update_option( 'page_on_front', $front_page_id->ID );
    update_option( 'page_for_posts', $blog_page_id->ID );

  }elseif('Idyllic Interior Architecture' === $selected_import['import_file_name'] ){
    // Assign menus to their locations.
    // Assign menus to their locations.
    $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
    $side_menu = get_term_by( 'name', 'Side Menu', 'nav_menu' );
    $social_link = get_term_by( 'name', 'Add Social Icons Only', 'nav_menu' );

    set_theme_mod( 'nav_menu_locations', array(
        'primary' => $main_menu->term_id,
        'side-nav-menu' => $side_menu->term_id,
        'social-link' => $social_link->term_id,
      )
    );

    // Assign front page and posts page (blog page).
    $front_page_id = get_page_by_title( 'Home' );
    $blog_page_id  = get_page_by_title( 'Blog' );

    update_option( 'show_on_front', 'page' );
    update_option( 'page_on_front', $front_page_id->ID );
    update_option( 'page_for_posts', $blog_page_id->ID );
    
  }elseif('Idyllic Creative Agency' === $selected_import['import_file_name'] ){
    // Assign menus to their locations.
    $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
    $side_menu = get_term_by( 'name', 'Side Menu', 'nav_menu' );
    $footer_menu = get_term_by( 'name', 'Footer Menu', 'nav_menu' );
    $social_link = get_term_by( 'name', 'Add Social Icons Only', 'nav_menu' );

    set_theme_mod( 'nav_menu_locations', array(
        'primary' => $main_menu->term_id,
        'side-nav-menu' => $side_menu->term_id,
        'footermenu' => $footer_menu->term_id,
        'social-link' => $social_link->term_id,
      )
    );

    // Assign front page and posts page (blog page).
    $front_page_id = get_page_by_title( 'Home' );
    $blog_page_id  = get_page_by_title( 'Blog' );

    update_option( 'show_on_front', 'page' );
    update_option( 'page_on_front', $front_page_id->ID );
    update_option( 'page_for_posts', $blog_page_id->ID );
    
  }else{
    // Assign menus to their locations for non profits 
    $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
    $social_link = get_term_by( 'name', 'Add Social Icons Only', 'nav_menu' );

    set_theme_mod( 'nav_menu_locations', array(
        'primary' => $main_menu->term_id,
        'social-link' => $social_link->term_id,
      )
    );

    // Assign front page and posts page (blog page).
    $front_page_id = get_page_by_title( 'Home' );
    $blog_page_id  = get_page_by_title( 'Blog' );

    update_option( 'show_on_front', 'page' );
    update_option( 'page_on_front', $front_page_id->ID );
    update_option( 'page_for_posts', $blog_page_id->ID );
  }

}
add_action( 'tf-tfdi/after_import', 'idyllic_after_import_setup' );