<?php 

/**
* Front Banner Section Layout One Hook 
*/
if ( ! function_exists( 'front_news_main_section_layout_one' ) ) :

    /**
     * breadcrumb
     *
     * @since 1.0.0
     */
    function front_news_main_section_layout_one() { 
        ?>
        <div class="col-12 col-sm-12 col-md-6 col-lg-8 col-xl-8">
            <div class="newshit-banner-slide-wrapper">
                <div class="newshit-section-arrows">
                    <button class="custom-slider-prev custom-arrow slick-arrow"><i class="fas fa-long-arrow-alt-left"></i></button>
                    <button class="custom-slider-next custom-arrow slick-arrow"><i class="fas fa-long-arrow-alt-right"></i></button>
                </div>
                <div class="newshit-post-items banner-post-slide">
                    <?php 
                        /**
                        * Hook - newshit_news_main_slider_loop_action.
                        */
                        do_action( 'newshit_news_main_slider_loop_action' );
                    ?>
                </div>
            </div>
        </div>
        
        <div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
            <div class="banner-tab-wrapper">

                <ul class="nav nav-tabs banner-post-tab-item" id="myTab" role="tablist">
                    <li class="nav-item" role="presentation">
                        <button class="nav-link active tab-title" id="banner-tab-one" data-bs-toggle="tab" data-bs-target="#banner-tab-content" type="button" role="tab" aria-controls="banner-tab-content" aria-selected="true"><?php echo esc_html( get_theme_mod( 'main_section_tab_one_title', 'Tranding' ) ); ?></button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link tab-title" id="banner-tab-two" data-bs-toggle="tab" data-bs-target="#banner-tab-content-two" type="button" role="tab" aria-controls="banner-tab-content-two" aria-selected="false"><?php echo esc_html( get_theme_mod( 'main_section_tab_two_title', 'Most Popular' ) ); ?></button>
                    </li>
                    
                </ul>

                <div class="tab-content banner-post-tab-content" id="myTabContent">
                    <div class="tab-pane fade show active" id="banner-tab-content" role="tabpanel" aria-labelledby="banner-tab-one">
                        <?php 
                            /**
                            * Hook - newshit_news_tranding_action.
                            */
                            do_action( 'newshit_news_tranding_action' );
                        ?>
                    </div>

                    <div class="tab-pane fade" id="banner-tab-content-two" role="tabpanel" aria-labelledby="banner-tab-two">
                        <?php 
                            /**
                            * Hook - newshit_news_most_popular_action.
                            */
                            do_action( 'newshit_news_most_popular_action' );
                        ?>
                    
                    </div>
                </div>
            </div>
        </div>
        <?php 
    }
endif;
add_action( 'front_news_main_section_layout_one_action', 'front_news_main_section_layout_one' );


/**
* Front Banner Section Layout Two Hook 
*/
if ( ! function_exists( 'front_news_main_section_layout_two' ) ) :

    /**
     * breadcrumb
     *
     * @since 1.0.0
     */
    function front_news_main_section_layout_two() { 
        ?>
        <div class="col-12 col-sm-12 col-md-6 col-lg-3 col-xl-3">
            <div class="banner-tab-wrapper">

                <?php if( !empty( get_theme_mod( 'main_section_tab_one_title', 'Tranding' ) ) ) : ?>
                    <div class="tab-title">
                        <?php echo esc_html( get_theme_mod( 'main_section_tab_one_title', 'Tranding' ) ); ?>
                    </div>
                <?php endif; ?>

                <?php 
                    /**
                    * Hook - newshit_news_tranding_action.
                    */
                    do_action( 'newshit_news_tranding_action' );
                ?>
            </div>
        </div>

        <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
            <div class="newshit-banner-slide-wrapper">
                <div class="newshit-section-arrows">
                    <button class="custom-slider-prev custom-arrow slick-arrow"><i class="fas fa-long-arrow-alt-left"></i></button>
                    <button class="custom-slider-next custom-arrow slick-arrow"><i class="fas fa-long-arrow-alt-right"></i></button>
                </div>
                <div class="newshit-post-items banner-post-slide">
                    <?php 
                        /**
                        * Hook - newshit_news_main_slider_loop_action.
                        */
                        do_action( 'newshit_news_main_slider_loop_action' );
                    ?>
                </div>
            </div>
        </div>

        <div class="col-12 col-sm-12 col-md-6 col-lg-3 col-xl-3">
            <div class="banner-tab-wrapper">
                <?php if( !empty( get_theme_mod( 'main_section_tab_two_title','Most Popular' ) ) ) : ?>
                        <div class="tab-title">
                            <?php echo esc_html( get_theme_mod( 'main_section_tab_two_title', 'Most Popular' ) ); ?>
                        </div>
                    <?php endif; ?>
                <?php 
                    /**
                    * Hook - newshit_news_most_popular_action.
                    */
                    do_action( 'newshit_news_most_popular_action' );
                ?>
            </div>
        </div>

        <?php 
    }
endif;
add_action( 'front_news_main_section_layout_two_action', 'front_news_main_section_layout_two' );



/**
* Front Banner Section Layout Three Hook 
*/
if ( ! function_exists( 'front_news_main_section_layout_three' ) ) :

    /**
     * breadcrumb
     *
     * @since 1.0.0
     */
    function front_news_main_section_layout_three() { 
        ?>
        <div class="col-12 col-sm-12 col-md-6 col-lg-8 col-xl-8">
            <div class="newshit-banner-slide-wrapper">
                <div class="newshit-section-arrows">
                    <button class="custom-slider-prev custom-arrow slick-arrow"><i class="fas fa-long-arrow-alt-left"></i></button>
                    <button class="custom-slider-next custom-arrow slick-arrow"><i class="fas fa-long-arrow-alt-right"></i></button>
                </div>
                <div class="newshit-post-items banner-post-slide">
                    <?php 
                        /**
                        * Hook - newshit_news_main_slider_loop_action.
                        */
                        do_action( 'newshit_news_main_slider_loop_action' );
                    ?>
                </div>
            </div>

            <?php if( true === get_theme_mod( 'news_main_section_ads_enable', true ) ) : ?>
                <div class="newshit-news-ads-wrapper mt-4">
                    <div class="newshit-global-ads-wrapper">
                        <?php if( get_theme_mod( 'news_main_section_ads_type', 'link' ) === 'link' && !empty( get_theme_mod( 'news_main_section_ads_image') ) ) : 
                            $ads = get_theme_mod( 'news_main_section_ads_image');
                            $ads_alt = get_post_meta( $ads['id'], '_wp_attachment_image_alt', true );
                            $ads_title = get_the_title( $ads['id']);
                        ?>
                            <a href="<?php echo esc_url_raw(get_theme_mod( 'news_main_section_ads_url')) ?>">
                                <img src="<?php echo esc_url($ads['url']); ?>" alt="<?php echo esc_attr($ads_alt); ?>" title="<?php echo esc_attr($ads_title); ?>">
                            </a>
                        <?php else : ?>
                            <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/image/ads/header-ads.png" alt="<?php esc_attr_e( 'NewsHit ads', 'newshit' ); ?>">
                        <?php endif; ?>
                    </div>
                </div>
            <?php endif; ?>
        </div>
        
        <div class="col-12 col-sm-12 col-md-6 col-lg-4 col-xl-4">
            <div class="banner-tab-wrapper <?php echo esc_attr( true === get_theme_mod( 'news_main_section_ads_enable', true ) ? 'show-main-ads' : 'no-main-ads' ); ?>">

                <ul class="nav nav-tabs banner-post-tab-item" id="myTab" role="tablist">
                    <li class="nav-item" role="presentation">
                        <button class="nav-link active tab-title" id="banner-tab-one" data-bs-toggle="tab" data-bs-target="#banner-tab-content" type="button" role="tab" aria-controls="banner-tab-content" aria-selected="true"><?php echo esc_html( get_theme_mod( 'main_section_tab_one_title', 'Tranding' ) ); ?></button>
                    </li>
                    <li class="nav-item" role="presentation">
                        <button class="nav-link tab-title" id="banner-tab-two" data-bs-toggle="tab" data-bs-target="#banner-tab-content-two" type="button" role="tab" aria-controls="banner-tab-content-two" aria-selected="false"><?php echo esc_html( get_theme_mod( 'main_section_tab_two_title', 'Most Popular' ) ); ?></button>
                    </li>
                    
                </ul>

                <div class="tab-content banner-post-tab-content" id="myTabContent">
                    <div class="tab-pane fade show active" id="banner-tab-content" role="tabpanel" aria-labelledby="banner-tab-one">
                        <?php 
                            /**
                            * Hook - newshit_news_tranding_action.
                            */
                            do_action( 'newshit_news_tranding_action' );
                        ?>
                    </div>

                    <div class="tab-pane fade" id="banner-tab-content-two" role="tabpanel" aria-labelledby="banner-tab-two">
                        <?php 
                            /**
                            * Hook - newshit_news_most_popular_action.
                            */
                            do_action( 'newshit_news_most_popular_action' );
                        ?>
                    
                    </div>
                </div>
            </div>
        </div>
        <?php 
    }
endif;
add_action( 'front_news_main_section_layout_three_action', 'front_news_main_section_layout_three' );