<?php 
/**
 * one click thme demo impoter
 * 
 * @package menda
 * @since 1.0
 */ 

add_filter( 'ocdi/import_files', 'menda_import_files' );
function menda_import_files() {

	$dir_url = get_template_directory_uri().'/demo-import';

  	return [
	    [
	      'import_file_name'           => 'Menda Layout 1',// title of the demo
	      'categories'                 => [ 'menda' ],
	      'import_file_url'            => $dir_url.'/xml/layout-1.xml',
	      'import_widget_file_url'     => $dir_url.'/xml/widget-1.wie',
	      'import_customizer_file_url' => $dir_url.'/xml/customizer-1.dat',

	    ],

	    /**
	     * 
	     * if you want to create seccond layout 
	     * than create using this code
	     * 
	     */ 
	    // [
	    //   'import_file_name'           => 'Demo Import 2',
	    //   'categories'                 => [ 'New category', 'Old category' ],
	    //   'import_file_url'            => 'http://www.your_domain.com/ocdi/demo-content2.xml',
	    //   'import_widget_file_url'     => 'http://www.your_domain.com/ocdi/widgets2.json',
	    //   'import_customizer_file_url' => 'http://www.your_domain.com/ocdi/customizer2.dat',
	    //   'import_redux'               => [
	    //     [
	    //       'file_url'    => 'http://www.your_domain.com/ocdi/redux.json',
	    //       'option_name' => 'redux_option_name',
	    //     ],
	    //     [
	    //       'file_url'    => 'http://www.your_domain.com/ocdi/redux2.json',
	    //       'option_name' => 'redux_option_name_2',
	    //     ],
	    //   ],
	    //   'import_preview_image_url'   => 'http://www.your_domain.com/ocdi/preview_import_image2.jpg',
	    //   'preview_url'                => 'http://www.your_domain.com/my-demo-2',
	    // ],
  	];
}


add_action( 'ocdi/after_import', 'ocdi_after_import_setup' );
function ocdi_after_import_setup() {

    // Assign menus to their locations.
    // $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
 
    // set_theme_mod( 'nav_menu_locations', [
    //         'main-menu' => $main_menu->term_id, // replace 'main-menu' here with the menu location identifier from register_nav_menu() function in your theme.
    //     ]
    // );
 
    // 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 );

}





	
