<?php
/**
 * @package Corporate Businessmen
 */

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

/**
 * Page Title Settings
 */
if ( ! function_exists( 'corporate_businessmen_show_page_title' ) ) :
    function corporate_businessmen_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
                                    // WooCommerce Pages
                                    if ( function_exists( 'is_shop' ) && is_shop() ) {
                                        // Shop Page
                                        echo '<h1 class="main-title">' . esc_html__( 'Shop Page', 'corporate-businessmen' ) . '</h1>';

                                    } elseif ( function_exists( 'is_product' ) && is_product() ) {
                                        // Single Product Page
                                        echo '<h1 class="main-title">' . esc_html__( 'Single Product Page', 'corporate-businessmen' ) . '</h1>';

                                    } elseif ( function_exists( 'is_checkout' ) && is_checkout() ) {
                                        // Checkout Page
                                        echo '<h1 class="main-title">' . esc_html__( 'Checkout', 'corporate-businessmen' ) . '</h1>';

                                    } elseif ( function_exists( 'is_account_page' ) && is_account_page() ) {
                                        // My Account Page
                                        echo '<h1 class="main-title">' . esc_html__( 'My Account', 'corporate-businessmen' ) . '</h1>';

                                    } elseif ( is_home() ) {
                                        // Blog Index Page
                                        echo '<h1 class="main-title">' . esc_html__( 'Blog Page', 'corporate-businessmen' ) . '</h1>';

                                    } elseif ( 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', 'corporate-businessmen' ) . '</h1>';

                                    } elseif ( is_404() ) {
                                        echo '<h1 class="main-title">' . esc_html__( 'Page Not Found', 'corporate-businessmen' ) . '</h1>';

                                    } else {
                                        // Default for all other pages
                                        echo '<h1 class="main-title">' . get_the_title() . '</h1>';
                                    }
                                    ?>
                                </div>                      
                            </div>
                        </div>
                    </div>  
                </div>
            </div>  <!-- End page-title --> 
            <?php
        }
    }
endif;

// Register page title action globally
add_action( 'corporate_businessmen_get_page_title', 'corporate_businessmen_show_page_title' );


/**
 * Home Banner Section
 */
if (! function_exists( 'corporate_businessmen_home_banner_section' ) ):
    function corporate_businessmen_home_banner_section() {
        ?>
        <section id="main-banner-wrap">
            <div class="slider-sec">
                <div class="owl-carousel">
                    <?php $corporate_businessmen_banner_count = get_theme_mod("corporate_businessmen_slider_increase");
                    for ($i = 1; $i <= $corporate_businessmen_banner_count; $i++) { ?>
                        <?php
                        $corporate_businessmen_banner_image = get_theme_mod( 'corporate_businessmen_banner_image'.$i, '' );
                        if ( ! empty( $corporate_businessmen_banner_image ) ) { ?>
                            <div class="banner-side-margin position-relative">
                                <div class="overlay-slider"></div>
                                <div class="main-banner-inner-box">
                                    <img src="<?php echo esc_url( $corporate_businessmen_banner_image ); ?>">
                                </div>
                                <?php
                                $corporate_businessmen_alignment_class = get_theme_mod( 'corporate_businessmen_slider_content_alignment', 'left' );
                                ?>
                                <div class="main-banner-content-box content-<?php echo esc_attr( $corporate_businessmen_alignment_class ); ?>">
                                    <?php
                                        $corporate_businessmen_banner_welcome_text = get_theme_mod( 'corporate_businessmen_banner_welcome_text'.$i, '' );
                                        if ( ! empty( $corporate_businessmen_banner_welcome_text ) ) { ?>                                 
                                            <p class="welcome-text"><?php echo esc_html(corporate_businessmen_get_text_excerpt( $corporate_businessmen_banner_welcome_text,1 )); ?></p>
                                    <?php } ?>
                                    <?php
                                        $corporate_businessmen_banner_small_head = get_theme_mod( 'corporate_businessmen_banner_small_head'.$i, '' );
                                        if ( ! empty( $corporate_businessmen_banner_small_head ) ) { ?>                                 
                                            <h6 class="bnr-sm-hd mb-4"><?php echo esc_html(corporate_businessmen_get_text_excerpt( $corporate_businessmen_banner_small_head,7 )); ?></h6>
                                    <?php } ?>
                                    <?php
                                        $corporate_businessmen_banner_heading = get_theme_mod( 'corporate_businessmen_banner_heading'.$i, '' );
                                        if ( ! empty( $corporate_businessmen_banner_heading ) ) { ?>
                                            <h2 class="bnr-heading p-0 mb-lg-2"><?php echo esc_html(corporate_businessmen_get_text_excerpt( $corporate_businessmen_banner_heading,7 )); ?></h2>
                                    <?php } ?>                                    <?php
                                        $corporate_businessmen_banner_content = get_theme_mod( 'corporate_businessmen_banner_content'.$i, '' );
                                        if ( ! empty( $corporate_businessmen_banner_content ) ) { ?>
                                            <p class="bnr-heading p-0 mb-lg-2"><?php echo esc_html( $corporate_businessmen_banner_content); ?></p>
                                    <?php } ?>                                   
                                   <div class="btn-box-slid py-1">
                                        <?php
                                        $corporate_businessmen_banner_button_link = get_theme_mod( 'corporate_businessmen_banner_button_link'.$i, '' );
                                            if ( ! empty( $corporate_businessmen_banner_button_link ) ) { ?>
                                            <a class="btn-slid btn" href="<?php echo esc_url( $corporate_businessmen_banner_button_link ); ?>"><?php echo esc_html('Get Started','corporate-businessmen'); ?></a>
                                        <?php } ?>
                                    </div>
                                </div>    
                            </div>
                        <?php } ?>
                    <?php } ?>
                </div>
            </div>
        </section>
        <?php
    }
endif;
add_action( 'corporate_businessmen_action_home_banner', 'corporate_businessmen_home_banner_section' );


/**
 * Home about Section
 */
if (! function_exists( 'corporate_businessmen_home_about_section' ) ):
    function corporate_businessmen_home_about_section() {
    ?>
    <section id="experiences-wrap">
            <div class="inner-wrap">
                <div class="container">
                    <div class="experiences-head-box">
                        <div class="row">
                            <div class="col-lg-6 align-self-center">
                                <?php
                                    $corporate_businessmen_learning_experiences_small_heading_1 = get_theme_mod( 'corporate_businessmen_learning_experiences_small_heading_1', '' );
                                    if ( ! empty( $corporate_businessmen_learning_experiences_small_heading_1 ) ) { ?>
                                    <h2 class="expernc-sm-hd"><?php echo esc_html( $corporate_businessmen_learning_experiences_small_heading_1 ); ?></h2>
                                <?php } ?> 
                                <?php
                                    $corporate_businessmen_learning_experiences_small_heading = get_theme_mod( 'corporate_businessmen_learning_experiences_small_heading', '' );
                                    if ( ! empty( $corporate_businessmen_learning_experiences_small_heading ) ) { ?>
                                    <h6 class="expernc-sm-hd pb-5 m-0 py-xl-5 py-lg-5 py-md-5"><?php echo esc_html( $corporate_businessmen_learning_experiences_small_heading ); ?></h6>
                                <?php } ?>    
                            </div>
                            <div class="col-lg-6 align-self-center">
                                <?php
                                    $corporate_businessmen_learning_experiences_main_heading = get_theme_mod( 'corporate_businessmen_learning_experiences_main_heading', '' );
                                    if ( ! empty( $corporate_businessmen_learning_experiences_main_heading ) ) { ?>
                                    <p class="expernc-main-hd pb-2 m-0 py-xl-5 py-lg-5 py-md-2"><?php echo esc_html( $corporate_businessmen_learning_experiences_main_heading ); ?></p>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="experiences-box py-5">
                    <div class="owl-carousel">
                        <?php $corporate_businessmen_learning_experiences_count = get_theme_mod("corporate_businessmen_learning_experiences_increase");
                        for ($i = 1; $i <= $corporate_businessmen_learning_experiences_count; $i++) { ?>
                            <div class="serv-detail">
                                <div class="serv-img-box">
                                    <?php
                                    $corporate_businessmen_learning_experiences_image = get_theme_mod( 'corporate_businessmen_learning_experiences_image'.$i, '' );
                                    if ( ! empty( $corporate_businessmen_learning_experiences_image ) ) { ?>
                                        <img src="<?php echo esc_url( $corporate_businessmen_learning_experiences_image ); ?>">
                                    <?php } ?>    
                                    <div class="serv-title">
                                        <?php
                                        $corporate_businessmen_learning_experiences_inner_heading = get_theme_mod( 'corporate_businessmen_learning_experiences_inner_heading' . $i, '' );
                                        $corporate_businessmen_learning_experiences_inner_link = get_theme_mod( 'corporate_businessmen_learning_experiences_inner_link' . $i, '' );

                                        if ( ! empty( $corporate_businessmen_learning_experiences_inner_heading ) ) { ?>
                                            <h6 class="serv-inn-hd pt-3 m-0">
                                                <a target="_blank" href="<?php echo esc_url( $corporate_businessmen_learning_experiences_inner_link ); ?>">
                                                    <?php echo esc_html( $corporate_businessmen_learning_experiences_inner_heading ); ?>
                                                </a>
                                            </h6>
                                        <?php } ?>
                                        <?php
                                            $corporate_businessmen_learning_experiences_designation_text = get_theme_mod( 'corporate_businessmen_learning_experiences_designation_text'.$i, '' );
                                            if ( ! empty( $corporate_businessmen_learning_experiences_designation_text ) ) { ?>
                                            <p class="serv-inn-hd pt-2 m-0"><?php echo esc_html( $corporate_businessmen_learning_experiences_designation_text ); ?></p>
                                        <?php } ?>
                                    </div>
                                </div>
                            </div> 
                        <?php } ?>
                    </div>
                </div>
            </div>                
    </section>
    <?php    
    }
endif;
add_action( 'corporate_businessmen_action_home_about', 'corporate_businessmen_home_about_section' );

/**
 * Home page another adding Section
 */
if (! function_exists( 'corporate_businessmen_home_extra_section' ) ):
    function corporate_businessmen_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( 'corporate_businessmen_action_home_extra', 'corporate_businessmen_home_extra_section' );