<?php
/**
 * Demo Data support.
 *
 * @package news-one
 */

/*Disable PT branding.*/
add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );

/**
 * Demo Data files.
 *
 * @since 1.0.0
 *
 * @return array Files.
 */
function news_one_import_files() {
    return array(
        array(
            'import_file_name'             =>  esc_html__( 'Theme Demo Content', 'news-one' ),
            'import_file_url'            => 'https://www.canyonthemes.com/assets/ocdi/news-one/content.xml',
            'import_widget_file_url'     => 'https://www.canyonthemes.com/assets/ocdi/news-one/widgets.wie',
            'import_customizer_file_url' => 'https://www.canyonthemes.com/assets/ocdi/news-one/custommizer.dat',
        ),
    );
}
add_filter( 'pt-ocdi/import_files', 'news_one_import_files' );

/**
 * Demo Data after import.
 *
 * @since 1.0.0
 */

function news_one_after_import_setup() {
    
    // Assign front page and posts page (blog page).
    //Set Front page
       $page = get_page_by_title( 'Home');
       if ( isset( $page->ID ) ) {
        update_option( 'page_on_front', $page->ID );
        update_option( 'show_on_front', 'page' );
       }

    
    

    if ( $front_page_id && $blog_page_id ) {
        update_option( 'show_on_front', 'page' );
        update_option( 'page_on_front', $front_page_id );
        update_option( 'page_for_posts', $blog_page_id );
    }
   
     // Assign navigation menu locations.
    $main_menu   = get_term_by('name', 'Main menu items', 'nav_menu');
    $social_menu = get_term_by('name', 'Social menu items', 'nav_menu');
    set_theme_mod( 'nav_menu_locations' , array( 
          'menu-1'      => $main_menu->term_id, 
          'social-menu' => $social_menu->term_id 
         ) 
    );
    }
add_action( 'pt-ocdi/after_import', 'news_one_after_import_setup' );