<?php
/**
 * @package Business Article Ship
 */

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


/**
 * Page Title Settings
 */
if (!function_exists('business_article_ship_show_page_title')) :
    function business_article_ship_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', 'business-article-ship') . '</h1>';
                                    } elseif (is_404()) {
                                        echo '<h1 class="main-title">' . esc_html__('Page Not Found', 'business-article-ship') . '</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( 'business_article_ship_home_banner_section' ) ):
    function business_article_ship_home_banner_section() {
        ?>
        <section id="main-banner-wrap">
            <div class="owl-carousel">
                <?php $business_article_ship_banner_count = get_theme_mod("business_article_ship_banner_slider_increase");
                    for ($i = 1; $i <= $business_article_ship_banner_count; $i++) { ?>
                    <?php
                        $business_article_ship_banner_image = get_theme_mod( 'business_article_ship_banner_image'.$i, '' );
                        if ( ! empty( $business_article_ship_banner_image ) ) { ?>
                    <div class="banner-side-margin position-relative">
                        <div class="main-banner-inner-box">                   
                            <img src="<?php echo esc_url( $business_article_ship_banner_image ); ?>">
                        </div>
                        <?php
                        $business_article_ship_alignment_class = get_theme_mod( 'business_article_ship_slider_content_alignment', 'left' );
                        ?>
                        <div class="main-banner-content-box content-<?php echo esc_attr( $business_article_ship_alignment_class ); ?>">                   
                            <?php
                                $business_article_ship_banner_heading = get_theme_mod( 'business_article_ship_banner_heading'.$i, '' );                        
                                if ( ! empty( $business_article_ship_banner_heading ) ) { ?>
                                    <h2 class="bnr-hd1 pt-2 mb-2"><?php echo esc_html( $business_article_ship_banner_heading ); ?></h2>
                            <?php } ?>
                            <?php
                                $business_article_ship_banner_text = get_theme_mod( 'business_article_ship_banner_text'.$i, '' );                        
                                if ( ! empty( $business_article_ship_banner_text ) ) { ?>
                                    <p class="bnr-txt"><?php echo esc_html( $business_article_ship_banner_text ); ?></p>
                            <?php } ?>
                            <div class="btn-box-slid">
                                <?php
                                $business_article_ship_banner_button_link = get_theme_mod( 'business_article_ship_banner_button_link'.$i, '' );
                                    if ( ! empty( $business_article_ship_banner_button_link ) ) { ?>
                                    <a class="btn-slid btn" href="<?php echo esc_url( $business_article_ship_banner_button_link ); ?>"><?php echo esc_html('VIEW MORE','business-article-ship'); ?></a>
                                <?php } ?>                                             
                            </div>
                        </div>
                    </div>
                    <?php } ?>
                <?php } ?>
            </div>
        </section>
        <?php
    }
endif;
add_action( 'business_article_ship_action_home_banner', 'business_article_ship_home_banner_section' );


/**
 * Home services Section
 */
if (! function_exists( 'business_article_ship_home_services_section' ) ):
    function business_article_ship_home_services_section() {
        ?>
        <section id="service-wrap" class="pt-5">
            <div class="container">
                <div class="row inner-wrap">
                    <div class="col-lg-5 col-md-12 col-12">
                        <div class="service-head-box py-5 text-center text-lg-start text-md-start">
                            <?php
                                $business_article_ship_services_small_heading = get_theme_mod( 'business_article_ship_services_small_heading', '' );
                                if ( ! empty( $business_article_ship_services_small_heading ) ) { ?>
                                <h6 class="servc-sm-hd pt-3"><?php echo esc_html( $business_article_ship_services_small_heading ); ?></h6>
                            <?php } ?>
                            <?php
                                $business_article_ship_services_main_heading = get_theme_mod( 'business_article_ship_services_main_heading', '' );
                                if ( ! empty( $business_article_ship_services_main_heading ) ) { ?>
                                <h3 class="servc-main-hd pt-2 mb-3"><?php echo esc_html( $business_article_ship_services_main_heading ); ?></h3>
                            <?php } ?>
                            <?php
                                $business_article_ship_services_text = get_theme_mod( 'business_article_ship_services_text', '' );
                                if ( ! empty( $business_article_ship_services_text ) ) { ?>
                                <p class="servc-text"><?php echo esc_html( $business_article_ship_services_text ); ?></p>
                            <?php } ?>
                        </div>
                    </div>
                    <div class="col-lg-5 col-md-9 col-12 align-self-center">
                        <div class="serv-cont-box row">                             
                            <?php $business_article_ship_services_count = get_theme_mod("business_article_ship_services_increase");
                                for ($i = 1; $i <= $business_article_ship_services_count; $i++) { ?>
                                <div class="col-lg-6 col-md-6 col-12">
                                    <div class="serv-detail px-3 py-4">
                                        <div class="row py-2">
                                            <div class="col-lg-3 col-md-3 col-3 align-self-center">
                                                <?php if(get_theme_mod('business_article_ship_services_icon'.$i)!=''){ ?>
                                                    <i class="<?php echo esc_html(get_theme_mod('business_article_ship_services_icon'.$i)); ?> serv-icon"></i>
                                                <?php } ?>
                                            </div>
                                            <div class="col-lg-9 col-md-9 col-9 align-self-center">
                                                <?php
                                                    $business_article_ship_services_inner_heading = get_theme_mod( 'business_article_ship_services_inner_heading'.$i, '' );
                                                    if ( ! empty( $business_article_ship_services_inner_heading ) ) { ?>
                                                    <h6 class="servc-inn-hd p-0 m-0"><?php echo esc_html( $business_article_ship_services_inner_heading ); ?></h6>
                                                <?php } ?>
                                            </div>
                                        </div>
                                    </div>                                    
                                </div>
                            <?php } ?>
                        </div>
                    </div>
                    <div class="col-lg-2 col-md-3 col-12">
                        <div class="serv-right-image-box">
                            <?php if(get_theme_mod('business_article_ship_services_right_image')!=''){ ?>
                                <img class="serv-right-img" src="<?php echo esc_url(get_theme_mod('business_article_ship_services_right_image')); ?>">
                            <?php }?>
                        </div>
                    </div>
                </div>                                
            </div>
        </section>
        <?php    
    }
endif;
add_action( 'business_article_ship_action_home_services', 'business_article_ship_home_services_section' );

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