<?php
/**
 * Functions which enhance the theme by hooking into WordPress
 *
 * @package Roland
 */

/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function roland_body_classes( $classes ) {
	// Adds a class of hfeed to non-singular pages.
	if ( ! is_singular() ) {
		$classes[] = 'hfeed';
	}

	// Adds a class of no-sidebar when there is no sidebar present.
	if ( ! is_active_sidebar( 'sidebar-1' ) ) {
		$classes[] = 'no-sidebar';
	}

	return $classes;
}
add_filter( 'body_class', 'roland_body_classes' );

/**
 * Add a pingback url auto-discovery header for single posts, pages, or attachments.
 */
function roland_pingback_header() {
	if ( is_singular() && pings_open() ) {
		printf( '<link rel="pingback" href="%s">', esc_url( get_bloginfo( 'pingback_url' ) ) );
	}
}
add_action( 'wp_head', 'roland_pingback_header' );


// Dashboard Notice
function roland_display_dashboard_notice() {
    ?>
    <div class="notice notice-info is-dismissible" style="font-size:16px; padding:25px">
        <b>
            <?php 
            printf( esc_html__( 'Hello, %s 👋🏻 You are using the free version.', 'roland' ), esc_html( get_bloginfo( 'name' ) ) ); 
            ?>
        </b>
        <h3 style="margin:0; margin-top:15px;">
            <?php esc_html_e( 'Buy roland Pro 🚨  &  Get All Premium features with WPBakery Page Builder', 'roland' ); ?>
        </h3>
        <p style="font-size:16px;">
            <?php esc_html_e( 'With our Pro version, you will get unlimited premium features, allowing you to build your multipurpose Medical, Clinic, Doctor or Hospital website in just 10 minutes! Enjoy custom widgets, 1-click demo website installation, premade demos, SEO optimization, and awesome theme options. Take your website to the next level!!', 'roland' ); ?>
        </p>
        <p style="font-size:16px; color: #ef644c; font-weight: bold;">
            <?php esc_html_e( ' Don\'t miss out on these incredible features - upgrade to Pro now! ', 'roland' ); ?>
        </p>
        <p style="margin:0;">
            <a href="<?php echo esc_url( 'https://pencilwp.com/product/roland-pro/' ); ?>" class="button button-primary" style="padding:5px 25px; font-size:16px;" target="_blank">
                <?php esc_html_e( 'Buy Pro', 'roland' ); ?>
            </a>
            <a href="<?php echo esc_url( 'https://demo.pencilwp.com/themes/roland-pro' ); ?>" class="button button-secondary" style="padding:5px 25px; font-size:16px;" target="_blank">
                <?php esc_html_e( 'View Pro Demo', 'roland' ); ?>
            </a>
        </p>
    </div>
    <?php
}
add_action( 'admin_notices', 'roland_display_dashboard_notice' );