<?php

/* Theme Setup */
if ( ! function_exists( 'prime_business_theme_setup' ) ) :

function prime_business_theme_setup() {

    // Theme Activation Notice
    global $pagenow;

    if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) {
        add_action( 'admin_notices', 'prime_business_activation_notice' );
    }
}

endif;
add_action( 'after_setup_theme', 'prime_business_theme_setup' );

// Notice after Theme Activation
function prime_business_activation_notice() {
    echo '<div class="notice notice-info is-dismissible get-started">';
        echo '<p>'. esc_html__( 'Thank you for choosing Prime Business. Please proceed towards the welcome page and give us the privilege to serve you.', 'prime-business' ) .'</p>';
        echo '<p><a href="'. esc_url( admin_url( 'themes.php?page=prime_business_about' ) ) .'" class="button button-primary">'. esc_html__( 'Get Started', 'prime-business' ) .'</a></p>';
    echo '</div>';
}

// Add a Custom CSS file to Admin Area
function prime_business_admin_theme_stylesheet() {
   wp_enqueue_style( 'custom-admin-style', get_template_directory_uri() .'/assets/css/admin-css.css' );
}
add_action( 'admin_enqueue_scripts', 'prime_business_admin_theme_stylesheet' );

//about theme info
function prime_business_add_main_theme_page() {
    add_theme_page( esc_html__( 'About Prime Business', 'prime-business' ), esc_html__( 'About Prime Business', 'prime-business' ), 'edit_theme_options', 'prime_business_about', 'prime_business_about' );
}
add_action( 'admin_menu', 'prime_business_add_main_theme_page' );

function prime_business_about() {

    $theme = wp_get_theme();
    $theme_name = $theme->get( 'Name' );
    $theme_description = $theme->get( 'Description' );
    $theme_user = wp_get_current_user();
    $theme_slug = basename( get_stylesheet_directory() );
?>

<div class="container about-theme">
    <div class="row">
        <?php /* translators: %s: theme name. */ ?>
        <h1><?php printf( esc_html__( 'Getting started with %s', 'prime-business' ), esc_html( $theme_name ) ); ?></h1>

        <?php /* translators: 1: Theme user name. 2: Theme name */ ?>
        <p><?php printf( esc_html__( 'Hi %1$s, thank you for installing %2$s!', 'prime-business' ), esc_html( $theme_user->display_name ), esc_html( $theme_name ) ); ?> <?php echo esc_html( $theme_description ); ?></p>

        <div class="six columns clearfix">
            <img src="<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/screenshot.png" class="screenshot" alt="Theme Screenshot" />
        </div><!-- /.six columns -->

        <div class="six columns">
            <h3><a href="https://www.crafthemes.com/docs/<?php echo esc_attr( $theme_slug ); ?>-documentation/" target="_blank"><?php esc_html_e( 'Theme Documentation', 'prime-business' ); ?></a></h3>
            <p>
                <?php esc_html_e( 'Read about all of the theme settings, and find out about its features.', 'prime-business' ); ?>
            </p>

            <h3><a href="https://www.crafthemes-demo.com/<?php echo esc_attr( $theme_slug ); ?>" target="_blank"><?php esc_html_e( 'Live Demo', 'prime-business' ); ?></a></h3>
            <p>
                <?php esc_html_e( 'Checkout the live demo of Prime Business.', 'prime-business' ); ?>
            </p>

            <h3><a href="<?php echo esc_url( 'https://www.crafthemes.com/docs/prime-business-documentation/demo-content-installation/' ); ?>" target="_blank"><?php esc_html_e( 'Import Demo Content', 'prime-business' ); ?></a></h3>
            <p>
                <?php esc_html_e( 'Tutorial on how to import demo data to look your website same as the demo website.', 'prime-business' ); ?>
            </p>
        </div><!-- /.six columns -->
    </div><!-- /.row -->
</div><!-- /.container about-writer -->

<?php
}
