public function _content_install_settings()
{
$this->_handle_delayed_posts(true);
// final wrap up of delayed posts.
$this->vc_post();
// final wrap of vc posts.
$custom_options = $this->_get_json('options.json');
// we also want to update the widget area manager options.
foreach ($custom_options as $option => $value) {
// we have to update widget page numbers with imported page numbers.
if (preg_match('#(wam__position_)(\\d+)_#', $option, $matches) || preg_match('#(wam__area_)(\\d+)_#', $option, $matches)) {
$new_page_id = $this->_imported_post_id($matches[2]);
if ($new_page_id) {
// we have a new page id for this one. import the new setting value.
$option = str_replace($matches[1] . $matches[2] . '_', $matches[1] . $new_page_id . '_', $option);
}
}
if ($value && !empty($value['custom_logo'])) {
$new_logo_id = $this->_imported_post_id($value['custom_logo']);
if ($new_logo_id) {
$value['custom_logo'] = $new_logo_id;
}
}
if ($option == 'dtbaker_featured_images') {
$value = maybe_unserialize($value);
$new_values = array();
if (is_array($value)) {
foreach ($value as $cat_id => $image_id) {
$new_cat_id = $this->_imported_term_id($cat_id);
$new_image_id = $this->_imported_post_id($image_id);
if ($new_cat_id && $new_image_id) {
$new_values[$new_cat_id] = $new_image_id;
}
}
}
$value = $new_values;
}
update_option($option, $value);
}
$menu_ids = $this->_get_json('menu.json');
$save = array();
foreach ($menu_ids as $menu_id => $term_id) {
$new_term_id = $this->_imported_term_id($term_id);
if ($new_term_id) {
$save[$menu_id] = $new_term_id;
}
}
if ($save) {
set_theme_mod('nav_menu_locations', array_map('absint', $save));
}
// set the blog page and the home page.
$shoppage = get_page_by_title('Shop');
if ($shoppage) {
update_option('woocommerce_shop_page_id', $shoppage->ID);
}
$shoppage = get_page_by_title('Cart');
if ($shoppage) {
update_option('woocommerce_cart_page_id', $shoppage->ID);
}
$shoppage = get_page_by_title('Checkout');
if ($shoppage) {
update_option('woocommerce_checkout_page_id', $shoppage->ID);
}
$shoppage = get_page_by_title('My Account');
if ($shoppage) {
update_option('woocommerce_myaccount_page_id', $shoppage->ID);
}
$homepage = get_page_by_title('Home');
if ($homepage) {
update_option('page_on_front', $homepage->ID);
update_option('show_on_front', 'page');
}
$blogpage = get_page_by_title('Blog');
if ($blogpage) {
update_option('page_for_posts', $blogpage->ID);
update_option('show_on_front', 'page');
}
global $wp_rewrite;
$wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
update_option('rewrite_rules', false);
$wp_rewrite->flush_rules(true);
return true;
}