<?php
/**
 * @package Quantic
 */

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


/**
 * Page Title Settings
 */
if (!function_exists('quantic_show_page_title')) :
    function quantic_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', 'quantic') . '</h1>';
                                    } elseif (is_404()) {
                                        echo '<h1 class="main-title">' . esc_html__('Page Not Found', 'quantic') . '</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( 'quantic_home_banner_section' ) ):
    function quantic_home_banner_section() {
        ?>
        <section id="main-banner-wrap">
            <div class="container-fluid">
                <div class="banner-side-margin">
                    <div class="row">
                        <div class="col-lg-11 col-md-11 col-11 position-relative">
                            <div class="main-banner-inner-box">
                                <?php
                                $quantic_banner_image = get_theme_mod( 'quantic_banner_image', '' );
                                if ( ! empty( $quantic_banner_image ) ) { ?>
                                    <img src="<?php echo esc_url( $quantic_banner_image ); ?>">
                                <?php } ?>
                            </div>
                            <?php
                            $quantic_alignment_class = get_theme_mod( 'quantic_slider_content_alignment', 'left' );
                            ?>
                            <div class="main-banner-content-box content-<?php echo esc_attr( $quantic_alignment_class ); ?>">
                                <?php
                                    $quantic_banner_small_heading = get_theme_mod( 'quantic_banner_small_heading', '' );
                                    if ( ! empty( $quantic_banner_small_heading ) ) { ?>
                                    <h6><?php echo esc_html( $quantic_banner_small_heading ); ?></h6>
                                <?php } ?>
                                <?php
                                    $quantic_banner_heading = get_theme_mod( 'quantic_banner_heading', '' );
                                    if ( ! empty( $quantic_banner_heading ) ) { ?>
                                    <h3><?php echo esc_html( $quantic_banner_heading ); ?></h3>
                                <?php } ?>
                                <?php
                                    $quantic_banner_text = get_theme_mod( 'quantic_banner_text', '' );
                                    if ( ! empty( $quantic_banner_text ) ) { ?>
                                    <p><?php echo esc_html( $quantic_banner_text ); ?></p>
                                <?php } ?>
                                <div class="banner-button">
                                    <?php
                                    $quantic_banner_button_link = get_theme_mod( 'quantic_banner_button_link', '' );
                                    if ( ! empty( $quantic_banner_button_link ) ) { ?>
                                        <a class="btn" href="<?php echo esc_url( $quantic_banner_button_link ); ?>"><?php echo esc_html('Get A Quote','quantic'); ?></a>
                                    <?php } ?>
                                </div>                            
                            </div>
                        </div>
                        <div class="col-lg-1 col-md-1 col-1 position-relative">
                            <div class="follow-us">
                                <span><?php echo esc_html( 'Follow Us','quantic' ); ?></span>
                                <?php
                                    $quantic_social_media1_heading = get_theme_mod( 'quantic_social_media1_heading', '' );
                                    if ( ! empty( $quantic_social_media1_heading ) ) { ?>
                                    <a href="<?php echo esc_url( $quantic_social_media1_heading ); ?>"><i class="bi bi-facebook"></i></a>
                                <?php } ?>
                                <?php
                                    $quantic_social_media2_heading = get_theme_mod( 'quantic_social_media2_heading', '' );
                                    if ( ! empty( $quantic_social_media2_heading ) ) { ?>
                                    <a href="<?php echo esc_url( $quantic_social_media2_heading ); ?>"><i class="bi bi-instagram"></i></a>
                                <?php } ?>
                                <?php
                                    $quantic_social_media3_heading = get_theme_mod( 'quantic_social_media3_heading', '' );
                                    if ( ! empty( $quantic_social_media3_heading ) ) { ?>
                                    <a href="<?php echo esc_url( $quantic_social_media3_heading ); ?>"><i class="bi bi-twitter-x"></i></a>
                                <?php } ?>
                                <?php
                                    $quantic_social_media4_heading = get_theme_mod( 'quantic_social_media4_heading', '' );
                                    if ( ! empty( $quantic_social_media4_heading ) ) { ?>
                                    <a href="<?php echo esc_url( $quantic_social_media4_heading ); ?>"><i class="bi bi-youtube"></i></a>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <?php    
    }
endif;
add_action( 'quantic_action_home_banner', 'quantic_home_banner_section' );


/**
 * Home About Section
 */
if (! function_exists( 'quantic_home_about_section' ) ):
    function quantic_home_about_section() {
        ?>
        <section id="about-wrap" class="py-5">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-lg-6 col-md-12 col-12">
                        <div class="about-image">
                            <div class="year-number">
                                <?php
                                $quantic_about_experience_number = get_theme_mod( 'quantic_about_experience_number', '' );
                                if ( ! empty( $quantic_about_experience_number ) ) { ?>
                                    <h4><?php echo esc_html( $quantic_about_experience_number ); ?></h4>
                                    <h5><?php echo esc_html('Experience','quantic'); ?></h5>
                                <?php } ?>
                            </div>
                            <?php
                            $quantic_about_image_big = get_theme_mod( 'quantic_about_image_big', '' );
                            if ( ! empty( $quantic_about_image_big ) ) { ?>
                                <img class="about-image1" src="<?php echo esc_url( $quantic_about_image_big ); ?>">
                            <?php } ?>
                            <div class="inner-about-image">
                                <?php
                                $quantic_about_image_small = get_theme_mod( 'quantic_about_image_small', '' );
                                if ( ! empty( $quantic_about_image_small ) ) { ?>
                                    <img class="about-image2" src="<?php echo esc_url( $quantic_about_image_small ); ?>">
                                <?php } ?>
                            </div>                        
                        </div>
                    </div>
                    <div class="col-lg-6 col-md-12 col-12 text-center text-lg-start text-md-start">
                        <?php
                            $quantic_about_short_heading = get_theme_mod( 'quantic_about_short_heading', '' );
                            if ( ! empty( $quantic_about_short_heading ) ) { ?>
                            <h4><?php echo esc_html( $quantic_about_short_heading ); ?></h4>
                        <?php } ?>
                        <?php
                            $quantic_about_heading = get_theme_mod( 'quantic_about_heading', '' );
                            if ( ! empty( $quantic_about_heading ) ) { ?>
                            <h3><?php echo esc_html( $quantic_about_heading ); ?></h3>
                        <?php } ?>
                        <?php
                            $quantic_about_content = get_theme_mod( 'quantic_about_content', '' );
                            if ( ! empty( $quantic_about_content ) ) { ?>
                            <p><?php echo esc_html( $quantic_about_content ); ?></p>
                        <?php } ?>
                        
                        <div class="row align-items-center">
                            <div class="col-lg-6 col-md-12 col-12">
                                <?php
                                    $quantic_about_achivement_number = get_theme_mod( 'quantic_about_achivement_number', '' );
                                    $quantic_about_achivement_text = get_theme_mod( 'quantic_about_achivement_text', '' );
                                    if ( ! empty( $quantic_about_achivement_number ) || ! empty( $quantic_about_achivement_text ) ) { ?>
                                    <div class="row about-icon m-0">
                                        <div class="col-3 text-center">
                                            <i class="bi bi-briefcase-fill"></i>
                                        </div>
                                        <div class="col-9">
                                            <h5><?php echo esc_html( $quantic_about_achivement_number ); ?></h5>
                                            <p><?php echo esc_html( $quantic_about_achivement_text ); ?></p>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                            <div class="col-lg-6 col-md-12 col-12">
                                <?php
                                    $quantic_about_leading_heading = get_theme_mod( 'quantic_about_leading_heading', '' );
                                    $quantic_about_leading_text = get_theme_mod( 'quantic_about_leading_text', '' );

                                    if ( ! empty( $quantic_about_leading_heading ) || ! empty( $quantic_about_leading_text ) ) { ?>
                                        <div class="row about-icon m-0">
                                            <div class="col-3 text-center">
                                                <i class="bi bi-person-fill"></i>
                                            </div>
                                            <div class="col-9">
                                                <h5><?php echo esc_html( $quantic_about_leading_heading ); ?></h5>
                                                <p><?php echo esc_html( $quantic_about_leading_text ); ?></p>
                                            </div>
                                        </div>
                                <?php } ?>
                            </div>
                        </div>

                        <?php
                            $quantic_about_content2 = get_theme_mod( 'quantic_about_content2', '' );
                            if ( ! empty( $quantic_about_content2 ) ) { ?>
                            <p><?php echo esc_html( $quantic_about_content2 ); ?></p>
                        <?php } ?>

                        <div class="banner-button">
                            <?php
                            $quantic_about_button_link = get_theme_mod( 'quantic_about_button_link', '' );
                            if ( ! empty( $quantic_about_button_link ) ) { ?>
                                <a class="btn" href="<?php echo esc_url( $quantic_about_button_link ); ?>"><?php echo esc_html('Read More','quantic'); ?></a>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <?php    
    }
endif;
add_action( 'quantic_action_home_about', 'quantic_home_about_section' );

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