fetch_attachments = true; $importer->import($file); } etheme_update_options($style); etheme_update_menus(); die('Success!'); } catch (Exception $e) { echo ("Error while importing"); } } } die(); } function etheme_update_options($style = 'e-commerce') { global $options_presets; $home_id = get_page_by_title('Home Page'); $blog_id = get_page_by_title('Blog');; update_option( 'show_on_front', 'page' ); update_option( 'page_on_front', $home_id->ID ); update_option( 'page_for_posts', $blog_id->ID ); add_option('demo_data_installed', 'yes'); // Update Theme Optinos $new_options = json_decode(base64_decode($options_presets[$style]),true); update_option( 'option_tree', $new_options ); } function etheme_update_menus(){ global $wpdb; $menuname = 'Main Menu'; $bpmenulocation = 'main-menu'; $mobilemenulocation = 'mobile-menu'; $tablename = $wpdb->prefix.'terms'; $menu_ids = $wpdb->get_results( " SELECT term_id FROM ".$tablename." WHERE name= '".$menuname."' " ); // results in array foreach($menu_ids as $menu): $menu_id = $menu->term_id; endforeach; if( !has_nav_menu( $bpmenulocation ) ){ $locations = get_theme_mod('nav_menu_locations'); $locations[$bpmenulocation] = $menu_id; $locations[$mobilemenulocation] = $menu_id; set_theme_mod( 'nav_menu_locations', $locations ); } }