<?php 

/**
* Front Content With Sidebar Hook 
*/
    if ( ! function_exists( 'front_content_with_sidebar_hook' ) ) :

    /**
     * breadcrumb
     *
     * @since 1.0.0
     */
    function front_content_with_sidebar_hook() { 
        
        ?>

        <div class="newshit-content-with-sidebar-wrapper pt-4 <?php echo esc_attr( get_theme_mod( 'select_content_type','content-right' ) ); ?>">
            <div class="container">
                <div class="row">
                    <?php if( 'content-left' === get_theme_mod( 'select_content_type' ) ){
                        /**
                        * Hook - newshit_home_sidebar_action.
                        */
                        do_action( 'newshit_home_sidebar_action' );
                    } ?>
                    <div class="col-12 col-sm-12 col-md-12 <?php echo esc_attr( 'content' !==  get_theme_mod( 'select_content_type', 'content-right' ) ? 'col-lg-8 col-xl-8' : 'col-lg-12 col-xl-12' ); ?>">
                        <div class="newshit-content-post-wrapper">
                            <?php 

                                /**
                                * Hook - newshit_category_section_post_action.
                                */
                                if( true === get_theme_mod( 'enable_category_section'  ) ){
                                    do_action( 'newshit_category_section_post_action');
                                }
                            ?>

                            <?php 
                                /**
                                * Hook - newshit_recent_post_section_post_action.
                                */
                                if( true === get_theme_mod( 'enable_recent_post_section', true ) ){
                                    do_action( 'newshit_recent_post_section_post_action');
                                }
                            ?>

                            <?php if( true === get_theme_mod( 'enable_recent_post_section_ads', false ) ) : ?>
                            <div class="newshit-recent-post-section-ads-wrapper mt-4 text-center">
                                <div class="newshit-global-ads-wrapper">
                                    <?php if( get_theme_mod( 'recent_post_section_ads_type', 'link' ) === 'link' && !empty( get_theme_mod( 'recent_post_section_ads_image') ) ) : 
                                        $ads = get_theme_mod( 'recent_post_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( 'recent_post_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 : ?>
                                        <div class="newshit-global-ads-code-wrapper">
                                            <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/image/ads/header-ads.png" alt="<?php esc_attr_e( 'NewsHit ads', 'newshit' ); ?>">
                                        </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                            <?php endif; ?>

                        </div>
                    </div>
                    <?php if( 'content-right' === get_theme_mod( 'select_content_type', 'content-right' ) ){
                        /**
                        * Hook - newshit_home_sidebar_action.
                        */
                        do_action( 'newshit_home_sidebar_action' );
                    } ?>
                </div>
            </div>
        </div>

    <?php }
endif;
add_action( 'front_content_with_sidebar_action', 'front_content_with_sidebar_hook' );