<?php
/**
 * @package Kindergarten Art School
 */

/**
 * Footer
 */
if (! function_exists( 'kindergarten_art_school_footer_copyrights' ) ):
    function kindergarten_art_school_footer_copyrights() {
        ?>
            <div class="row">
                <div class="copyrights">
                    <p>
                        <?php
                            if("" != esc_html(get_theme_mod( 'kindergarten_art_school_footer_copyright_text'))) :
                                echo esc_html(get_theme_mod( 'kindergarten_art_school_footer_copyright_text'));
                                if(get_theme_mod('kindergarten_art_school_en_footer_credits',true)) :
                                    ?> 
                                    <span class="copyrg-link"><a href="<?php echo esc_url(KINDERGARTEN_ART_SCHOOL_AUT); ?>" target="_blank" rel="nofollow noopener"><?php esc_html_e(' | Art School WordPress Theme','kindergarten-art-school') ?></a><?php esc_html_e(' by Legacy Themes','kindergarten-art-school') ?></span>
                                    <?php   
                                endif;
                            else :
                                echo date_i18n(
                                    /* translators: Copyright date format, see https://secure.php.net/date */
                                    _x( 'Y', 'copyright date format', 'kindergarten-art-school' )
                                );
                                ?>
                                    <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a>
                                    <span class="copyrg-link"><a href="<?php echo esc_url(KINDERGARTEN_ART_SCHOOL_AUT); ?>" target="_blank" rel="nofollow noopener"><?php esc_html_e(' | Art School WordPress Theme','kindergarten-art-school') ?></a><?php esc_html_e(' by Legacy Themes','kindergarten-art-school') ?></span>
                                <?php
                            endif;
                        ?>
                    </p>
                </div>
            </div>
        <?php    
    }
endif;
add_action( 'kindergarten_art_school_action_footer', 'kindergarten_art_school_footer_copyrights' );


/**
 * Page Title Settings
 */
if (!function_exists('kindergarten_art_school_show_page_title')) :
    function kindergarten_art_school_show_page_title() {
        if (!is_front_page()) {
            ?>
            <div class="page-title"> 
                <div class="content-section img-overlay">
                    <div class="container">
                        <div class="row text-center">
                            <div class="col-md-12">
                                <div class="section-title"> 
                                    <?php
                                    if (is_singular('post')) {
                                        // Single blog post
                                        echo '<h1 class="main-title">' . get_the_title() . '</h1>';
                                    } elseif (is_category()) {
                                        echo '<h1 class="main-title">' . single_cat_title('', false) . '</h1>';
                                    } elseif (is_tag()) {
                                        echo '<h1 class="main-title">' . single_tag_title('', false) . '</h1>';
                                    } elseif (is_author()) {
                                        echo '<h1 class="main-title">' . get_the_author() . '</h1>';
                                    } elseif (is_archive()) {
                                        echo '<h1 class="main-title">' . get_the_archive_title() . '</h1>';
                                    } elseif (is_search()) {
                                        echo '<h1 class="main-title">' . esc_html__('Search Results', 'kindergarten-art-school') . '</h1>';
                                    } elseif (is_404()) {
                                        echo '<h1 class="main-title">' . esc_html__('Page Not Found', 'kindergarten-art-school') . '</h1>';
                                    } else {
                                        echo '<h1 class="main-title">' . get_the_title() . '</h1>';
                                    }
                                    ?>
                                </div>                      
                            </div>
                        </div>
                    </div>  
                </div>
            </div>  <!-- End page-title --> 
            <?php
        }
    }
endif;



/**
 * Home Banner Section
 */
if (! function_exists( 'kindergarten_art_school_home_banner_section' ) ):
    function kindergarten_art_school_home_banner_section() {
        ?>
        <section id="main-banner-wrap">
            <div class="banner-side-margin position-relative">
                <div class="main-banner-inner-box">                   
                   <?php $kindergarten_art_school_banner_image = get_stylesheet_directory_uri() . '/img/Bg2.png'; ?>
                   <img src="<?php echo esc_url($kindergarten_art_school_banner_image); ?>" class="bg-slid">
                
                <div class="bnr-detail">
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-6">
                            <?php
                            $kindergarten_art_school_alignment_class = get_theme_mod( 'kindergarten_art_school_slider_content_alignment', 'left' );
                            ?>
                            <div class="main-banner-content-box content-<?php echo esc_attr( $kindergarten_art_school_alignment_class ); ?>">
                                <?php
                                    $kindergarten_art_school_banner_heading = get_theme_mod( 'kindergarten_art_school_banner_heading', '' );                        
                                    if ( ! empty( $kindergarten_art_school_banner_heading ) ) { ?>
                                        <h2 id="banner-heading" class="bnr-hd1 p-0 mb-0 mb-lg-3"><?php echo esc_html( $kindergarten_art_school_banner_heading ); ?></h2>
                                <?php } ?>
                                <?php
                                    $kindergarten_art_school_banner_small_head = get_theme_mod( 'kindergarten_art_school_banner_small_head', '' );
                                    if ( ! empty( $kindergarten_art_school_banner_small_head ) ) { ?>
                                    <h6 class="bnnr-sm-hd m-0 p-0"><?php echo esc_html( $kindergarten_art_school_banner_small_head ); ?></h6>
                                <?php } ?>
                                <?php
                                    $kindergarten_art_school_banner_text = get_theme_mod( 'kindergarten_art_school_banner_text', '' );
                                    if ( ! empty( $kindergarten_art_school_banner_text ) ) { ?>
                                    <p class="bnnr-txt m-0 py-3"><?php echo esc_html( $kindergarten_art_school_banner_text ); ?></p>
                                <?php } ?>                     
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-6">
                            <div class="bgplace">
                                <div class="right-bnr-img">
                                <?php
                                    $kindergarten_art_school_banner_right_image = get_theme_mod( 'kindergarten_art_school_banner_right_image', '' );
                                    if ( ! empty( $kindergarten_art_school_banner_right_image ) ) { ?>
                                        <img src="<?php echo esc_url( $kindergarten_art_school_banner_right_image ); ?>">
                                <?php } ?>
                            </div>
                            </div>
                            
                        </div>
                    </div>
                </div>
                <?php
                    $kindergarten_art_school_banner_button_link = get_theme_mod( 'kindergarten_art_school_banner_button_link', '' );
                    if ( ! empty( $kindergarten_art_school_banner_button_link ) ) { ?>
                    <div class="slider-button">
                        <a href="<?php echo esc_url( $kindergarten_art_school_banner_button_link ); ?>" class="slid-btn"><?php echo esc_html("Book\nNow", 'kindergarten-art-school'); ?></a>
                    </div> 
                <?php } ?>  
                </div>  
            </div>
            
        </section>
        <?php
    }
endif;
add_action( 'kindergarten_art_school_action_home_banner', 'kindergarten_art_school_home_banner_section' );


/**
 * Home services Section
 */
if (! function_exists( 'kindergarten_art_school_home_services_section' ) ):
    function kindergarten_art_school_home_services_section() {
        ?>
        <section id="services-wrap" class="py-5">
            <div class="container">
                <div class="inner-wrap">
                    <div class="services-head text-center mb-5 pb-3">
                        <?php
                            $kindergarten_art_school_services_main_heading = get_theme_mod( 'kindergarten_art_school_services_main_heading', '' );
                            if ( ! empty( $kindergarten_art_school_services_main_heading ) ) { ?>
                            <h3 class="serv-main-hd py-3 mb-0"><?php echo esc_html( $kindergarten_art_school_services_main_heading ); ?></h3>
                        <?php } ?>
                        <?php
                            $kindergarten_art_school_services_text = get_theme_mod( 'kindergarten_art_school_services_text', '' );
                            if ( ! empty( $kindergarten_art_school_services_text ) ) { ?>
                            <p class="servic-txt mb-0"><?php echo esc_html( $kindergarten_art_school_services_text ); ?></p>
                        <?php } ?>
                    </div>
                    <div class="services-box text-center">
                        <div class="serv-cont-box row">                             
                            <?php $kindergarten_art_school_services_count = get_theme_mod("kindergarten_art_school_services_increase");
                            for ($i = 1; $i <= $kindergarten_art_school_services_count; $i++) { ?>
                            <div class="col-lg-3 col-md-6 col-12 mb-5">
                                <div class="serv-detail">              
                                    <div class="serv-img-box p-4">
                                       <?php
                                        $kindergarten_art_school_services_image = get_theme_mod( 'kindergarten_art_school_services_image'.$i, '' );
                                        if( ! empty( $kindergarten_art_school_services_image ) ) { ?>  
                                        <div class="serv-inner-box <?php { echo 'serv-overlay'.$i; }?>">
                                            <img src="<?php echo esc_url( $kindergarten_art_school_services_image ); ?>">
                                        </div>
                                        <?php } ?>
                                        <div class="serv-title text-start">
                                            <?php
                                                $kindergarten_art_school_services_inner_heading = get_theme_mod( 'kindergarten_art_school_services_inner_heading'.$i, '' );
                                                if ( ! empty( $kindergarten_art_school_services_inner_heading ) ) { ?>
                                                <h6 class="servc-inn-hd p-0 m-0"><?php echo esc_html( $kindergarten_art_school_services_inner_heading ); ?></h6>
                                            <?php } ?>
                                        </div>
                                    </div>
                                </div>                                    
                            </div>
                            <?php } ?>
                        </div>
                    </div>                
                </div>                
            </div>
        </section>
        <?php    
    }
endif;
add_action( 'kindergarten_art_school_action_home_services', 'kindergarten_art_school_home_services_section' );

/**
 * Home page another adding Section
 */
if (! function_exists( 'kindergarten_art_school_home_extra_section' ) ):
    function kindergarten_art_school_home_extra_section() {
        ?>
        <div id="custom-home-extra-content" class="py-3">
            <div class="container">
              <?php while ( have_posts() ) : the_post(); ?>
                <?php the_content(); ?>
              <?php endwhile; ?>
            </div>
        </div>
        <?php    
    }
endif;
add_action( 'kindergarten_art_school_action_home_extra', 'kindergarten_art_school_home_extra_section' );