<?php
// /**
//  * Demo Import.
//  *
//  * This is the template that includes all the other files for core featured of Theme Palace
//  *
//  * @package Theme Palace
//  * @subpackage Charity Give
//  * @since Charity Give 1.0.0
//  */


function charity_give_ctdi_plugin_page_setup( $default_settings ) {
    $default_settings['menu_title']  = esc_html__( 'Theme Palace Demo Import' , 'charity-give' );

    return $default_settings;
}
add_filter( 'cp-ctdi/plugin_page_setup', 'charity_give_ctdi_plugin_page_setup' );


function  charity_give_ctdi_plugin_intro_text( $default_text ) {
    $default_text .= sprintf( '<p class="about-description">%1$s <a href="%2$s">%3$s</a></p>', esc_html__( 'Demo content files for Charity Give theme.', 'charity-give' ),
    esc_url( 'https://themepalace.com/instructions/themes/charity-give/' ), esc_html__( 'Click here for Demo File download', 'charity-give' ) );
    return $default_text;
}
add_filter( 'cp-ctdi/plugin_intro_text', 'charity_give_ctdi_plugin_intro_text' );

function charity_give_ctdi_after_import_setup() {
    // Assign menus to their locations.
    $main_menu = get_term_by( 'name', 'primary', 'nav_menu' );
    $secondary_menu = get_term_by( 'name', 'secondary', 'nav_menu' );
    $social = get_term_by('name', 'social', 'nav_menu');

    set_theme_mod( 'nav_menu_locations', array(
            'primary' => $main_menu->term_id,
            'secondary' => $secondary_menu->term_id,
            'social' => $social->term_id,
        )
    );

    // 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 );

}
add_action( 'cp-ctdi/after_import', 'charity_give_ctdi_after_import_setup' );
