<?php
/**
 * Demo Data support.
 *
 * @package glowmag
 */

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

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

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

function glowmag_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', 'Primary Menu', 'nav_menu');
    $social_menu = get_term_by('name', 'Social Links', 'nav_menu');
	$top_menu = get_term_by('name', 'Top Header menu', 'nav_menu');
	
    set_theme_mod( 'nav_menu_locations' , array( 
          'primary'      => $main_menu->term_id, 
          'social-link' => $social_menu->term_id,
		  'top-header' => $top_menu->term_id
         ) 
    );
    }
add_action( 'pt-ocdi/after_import', 'glowmag_after_import_setup' );