<?php
/**
 * Custom Functions.
 *
 * @package OTT Vlogger
 */

if( !function_exists( 'ott_vlogger_fonts_url' ) ) :

    //Google Fonts URL
    function ott_vlogger_fonts_url(){

        $ott_vlogger_font_families = array(
            'IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700',
            'Mulish:ital,wght@0,200..1000;1,200..1000',
        );

        $ott_vlogger_fonts_url = add_query_arg( array(
            'family' => implode( '&family=', $ott_vlogger_font_families ),
            'display' => 'swap',
        ), 'https://fonts.googleapis.com/css2' );

        return esc_url_raw($ott_vlogger_fonts_url);
    }

endif;

if ( ! function_exists( 'ott_vlogger_sub_menu_toggle_button' ) ) :

    function ott_vlogger_sub_menu_toggle_button( $ott_vlogger_args, $ott_vlogger_item, $depth ) {

        // Add sub menu toggles to the main menu with toggles
        if ( $ott_vlogger_args->theme_location == 'ott-vlogger-primary-menu' && isset( $ott_vlogger_args->show_toggles ) ) {
            
            // Wrap the menu item link contents in a div, used for positioning
            $ott_vlogger_args->before = '<div class="submenu-wrapper">';
            $ott_vlogger_args->after  = '';

            // Add a toggle to items with children
            if ( in_array( 'menu-item-has-children', $ott_vlogger_item->classes ) ) {

                $toggle_target_string = '.menu-item.menu-item-' . $ott_vlogger_item->ID . ' > .sub-menu';

                // Add the sub menu toggle
                $ott_vlogger_args->after .= '<button type="button" class="theme-aria-button submenu-toggle" data-toggle-target="' . $toggle_target_string . '" data-toggle-type="slidetoggle" data-toggle-duration="250" aria-expanded="false"><span class="btn__content" tabindex="-1"><span class="screen-reader-text">' . esc_html__( 'Show sub menu', 'ott-vlogger' ) . '</span>' . ott_vlogger_get_theme_svg( 'chevron-down' ) . '</span></button>';

            }

            // Close the wrapper
            $ott_vlogger_args->after .= '</div><!-- .submenu-wrapper -->';
            // Add sub menu icons to the main menu without toggles (the fallback menu)

        }elseif( $ott_vlogger_args->theme_location == 'ott-vlogger-primary-menu' ) {

            if ( in_array( 'menu-item-has-children', $ott_vlogger_item->classes ) ) {

                $ott_vlogger_args->before = '<div class="link-icon-wrapper">';
                $ott_vlogger_args->after  = ott_vlogger_get_theme_svg( 'chevron-down' ) . '</div>';

            } else {

                $ott_vlogger_args->before = '';
                $ott_vlogger_args->after  = '';

            }

        }

        return $ott_vlogger_args;

    }

endif;

add_filter( 'nav_menu_item_args', 'ott_vlogger_sub_menu_toggle_button', 10, 3 );

if ( ! function_exists( 'ott_vlogger_the_theme_svg' ) ):
    
    function ott_vlogger_the_theme_svg( $ott_vlogger_svg_name, $ott_vlogger_return = false ) {

        if( $ott_vlogger_return ){

            return ott_vlogger_get_theme_svg( $ott_vlogger_svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in ott_vlogger_get_theme_svg();.

        }else{

            echo ott_vlogger_get_theme_svg( $ott_vlogger_svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in ott_vlogger_get_theme_svg();.

        }
    }

endif;

if ( ! function_exists( 'ott_vlogger_get_theme_svg' ) ):

    function ott_vlogger_get_theme_svg( $ott_vlogger_svg_name ) {

        // Make sure that only our allowed tags and attributes are included.
        $ott_vlogger_svg = wp_kses(
            OTT_Vlogger_SVG_Icons::get_svg( $ott_vlogger_svg_name ),
            array(
                'svg'     => array(
                    'class'       => true,
                    'xmlns'       => true,
                    'width'       => true,
                    'height'      => true,
                    'viewbox'     => true,
                    'aria-hidden' => true,
                    'role'        => true,
                    'focusable'   => true,
                ),
                'path'    => array(
                    'fill'      => true,
                    'fill-rule' => true,
                    'd'         => true,
                    'transform' => true,
                ),
                'polygon' => array(
                    'fill'      => true,
                    'fill-rule' => true,
                    'points'    => true,
                    'transform' => true,
                    'focusable' => true,
                ),
                'polyline' => array(
                    'fill'      => true,
                    'points'    => true,
                ),
                'line' => array(
                    'fill'      => true,
                    'x1'      => true,
                    'x2' => true,
                    'y1'    => true,
                    'y2' => true,
                ),
            )
        );
        if ( ! $ott_vlogger_svg ) {
            return false;
        }
        return $ott_vlogger_svg;

    }

endif;

if( !function_exists( 'ott_vlogger_post_category_list' ) ) :

    // Post Category List.
    function ott_vlogger_post_category_list( $ott_vlogger_select_cat = true ){

        $ott_vlogger_post_cat_lists = get_categories(
            array(
                'hide_empty' => '0',
                'exclude' => '1',
            )
        );

        $ott_vlogger_post_cat_cat_array = array();
        if( $ott_vlogger_select_cat ){

            $ott_vlogger_post_cat_cat_array[''] = esc_html__( '-- Select Category --','ott-vlogger' );

        }

        foreach ( $ott_vlogger_post_cat_lists as $ott_vlogger_post_cat_list ) {

            $ott_vlogger_post_cat_cat_array[$ott_vlogger_post_cat_list->slug] = $ott_vlogger_post_cat_list->name;

        }

        return $ott_vlogger_post_cat_cat_array;
    }

endif;

if( !function_exists('ott_vlogger_single_post_navigation') ):

    function ott_vlogger_single_post_navigation(){

        $ott_vlogger_footer_column_layout = ott_vlogger_get_default_theme_options();
        $ott_vlogger_twp_navigation_type = esc_attr( get_post_meta( get_the_ID(), 'ott_vlogger_twp_disable_ajax_load_next_post', true ) );
        $ott_vlogger_current_id = '';
        $article_wrap_class = '';
        global $post;
        $ott_vlogger_current_id = $post->ID;
        if( $ott_vlogger_twp_navigation_type == '' || $ott_vlogger_twp_navigation_type == 'global-layout' ){
            $ott_vlogger_twp_navigation_type = get_theme_mod('ott_vlogger_twp_navigation_type', $ott_vlogger_footer_column_layout['ott_vlogger_twp_navigation_type']);
        }

        if( $ott_vlogger_twp_navigation_type != 'no-navigation' && 'post' === get_post_type() ){

            if( $ott_vlogger_twp_navigation_type == 'theme-normal-navigation' ){ ?>

                <div class="navigation-wrapper">
                    <?php
                    // Previous/next post navigation.
                    the_post_navigation(array(
                        'prev_text' => '<span class="arrow" aria-hidden="true">' . ott_vlogger_the_theme_svg('arrow-left',$ott_vlogger_return = true ) . '</span><span class="screen-reader-text">' . esc_html__('Previous post:', 'ott-vlogger') . '</span><span class="post-title">%title</span>',
                        'next_text' => '<span class="arrow" aria-hidden="true">' . ott_vlogger_the_theme_svg('arrow-right',$ott_vlogger_return = true ) . '</span><span class="screen-reader-text">' . esc_html__('Next post:', 'ott-vlogger') . '</span><span class="post-title">%title</span>',
                    )); ?>
                </div>
                <?php

            }else{

                $ott_vlogger_next_post = get_next_post();
                if( isset( $ott_vlogger_next_post->ID ) ){

                    $ott_vlogger_next_post_id = $ott_vlogger_next_post->ID;
                    echo '<div loop-count="1" next-post="' . absint( $ott_vlogger_next_post_id ) . '" class="twp-single-infinity"></div>';

                }
            }

        }

    }

endif;

add_action( 'ott_vlogger_navigation_action','ott_vlogger_single_post_navigation',30 );

if( !function_exists('ott_vlogger_content_offcanvas') ):

    // Offcanvas Contents
    function ott_vlogger_content_offcanvas(){ ?>

        <div id="offcanvas-menu">
            <div class="offcanvas-wraper">
                <div class="close-offcanvas-menu">
                    <div class="offcanvas-close">
                        <a href="javascript:void(0)" class="skip-link-menu-start"></a>
                        <button type="button" class="button-offcanvas-close">
                            <span class="offcanvas-close-label">
                                <?php echo esc_html__('Close', 'ott-vlogger'); ?>
                            </span>
                        </button>
                    </div>
                </div>
                <div id="primary-nav-offcanvas" class="offcanvas-item offcanvas-main-navigation">
                    <nav class="primary-menu-wrapper" aria-label="<?php esc_attr_e('Horizontal', 'ott-vlogger'); ?>" role="navigation">
                        <ul class="primary-menu theme-menu">
                            <?php
                            if (has_nav_menu('ott-vlogger-primary-menu')) {
                                wp_nav_menu(
                                    array(
                                        'container' => '',
                                        'items_wrap' => '%3$s',
                                        'theme_location' => 'ott-vlogger-primary-menu',
                                        'show_toggles' => true,
                                    )
                                );
                            }else{

                                wp_list_pages(
                                    array(
                                        'match_menu_classes' => true,
                                        'show_sub_menu_icons' => true,
                                        'title_li' => false,
                                        'show_toggles' => true,
                                        'walker' => new OTT_Vlogger_Walker_Page(),
                                    )
                                );
                            }
                            ?>
                        </ul>
                    </nav><!-- .primary-menu-wrapper -->
                </div>
                <a href="javascript:void(0)" class="skip-link-menu-end"></a>
            </div>
        </div>

    <?php
    }

endif;

add_action( 'ott_vlogger_before_footer_content_action','ott_vlogger_content_offcanvas',30 );

if( !function_exists('ott_vlogger_footer_content_widget') ):

    function ott_vlogger_footer_content_widget(){
        
        $ott_vlogger_default = ott_vlogger_get_default_theme_options();
        
        $ott_vlogger_footer_column_layout = absint(get_theme_mod('ott_vlogger_footer_column_layout', $ott_vlogger_default['ott_vlogger_footer_column_layout']));
        $ott_vlogger_footer_sidebar_class = 12;
        
        if($ott_vlogger_footer_column_layout == 2) {
            $ott_vlogger_footer_sidebar_class = 6;
        }
        
        if($ott_vlogger_footer_column_layout == 3) {
            $ott_vlogger_footer_sidebar_class = 4;
        }
        ?>
        
        <?php if ( get_theme_mod('ott_vlogger_display_footer', true) == true ) : ?>
            <div class="footer-widgetarea">
                <div class="wrapper">
                    <div class="column-row">
                    
                        <?php for ($i = 0; $i < $ott_vlogger_footer_column_layout; $i++) : ?>
                            
                            <div class="column <?php echo 'column-' . absint($ott_vlogger_footer_sidebar_class); ?> column-sm-12">
                                
                                <?php 
                                // If no widgets are assigned, display default widgets
                                if ( ! is_active_sidebar( 'ott-vlogger-footer-widget-' . $i ) ) : 

                                    if ($i === 0) : ?>
                                        <div id="media_image-3" class="widget widget_media_image">
                                            <img src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/logo.png'); ?>" alt="<?php echo esc_attr__( 'Footer Image', 'ott-vlogger' ); ?>" style="max-width: 100%; height: auto;">
                                        </div>
                                        <div id="text-3" class="widget widget_text">
                                            <div class="textwidget">
                                                <p class="widget_text">
                                                    <?php esc_html_e('OTT Vlogger is a comprehensive WordPress theme designed specifically for video bloggers and content creators. Whether you are a YouTube vlogger, video blogger, vlogging tips, vlogger content, vlog channel, vlogger equipment, vlogger setup, vlogger marketing, daily vlogger, travel vlogger, lifestyle vlogger, vlogging camera, vlogger branding, vlogging techniques, vlogger growth, vlogger community video influencer, or aspiring content creator, this theme provides all the tools you need to build a captivating and professional online presence.', 'ott-vlogger'); ?>
                                                </p>
                                            </div>
                                        </div>

                                    <?php elseif ($i === 1) : ?>
                                        <div id="pages-2" class="widget widget_pages">
                                            <h2 class="widget-title"><?php esc_html_e('Calendar', 'ott-vlogger'); ?></h2>
                                            <?php get_calendar(); ?>
                                        </div>

                                    <?php elseif ($i === 2) : ?>
                                        <div id="search-2" class="widget widget_search">
                                            <h2 class="widget-title"><?php esc_html_e('Enter Keywords Here', 'ott-vlogger'); ?></h2>
                                            <?php get_search_form(); ?>
                                        </div>
                                    <?php endif; 
                                    
                                else :
                                    // Display dynamic sidebar widget if assigned
                                    dynamic_sidebar('ott-vlogger-footer-widget-' . $i);
                                endif;
                                ?>
                                
                            </div>
                            
                        <?php endfor; ?>

                    </div>
                </div>
            </div>
        <?php endif; ?> 

    <?php
    }

endif;

add_action( 'ott_vlogger_footer_content_action', 'ott_vlogger_footer_content_widget', 10 );

if( !function_exists('ott_vlogger_footer_content_info') ):

    /**
     * Footer Copyright Area
    **/
    function ott_vlogger_footer_content_info(){

        $ott_vlogger_footer_column_layout = ott_vlogger_get_default_theme_options(); ?>
        <div class="site-info">
            <div class="wrapper">
                <div class="column-row">
                    <div class="column column-9">
                        <div class="footer-credits">
                            <div class="footer-copyright">
                                <?php
                                $ott_vlogger_footer_copyright_text = wp_kses_post( get_theme_mod( 'ott_vlogger_footer_copyright_text', $ott_vlogger_footer_column_layout['ott_vlogger_footer_copyright_text'] ) );
                                    echo esc_html( $ott_vlogger_footer_copyright_text );

                                    echo '<br>';
                                    echo esc_html__('Theme: ', 'ott-vlogger') . '<a href="' . esc_url('https://www.omegathemes.com/products/free-vlogger-wordpress-theme') . '" title="' . esc_attr__('OTT Vlogger ', 'ott-vlogger') . '" target="_blank"><span>' . esc_html__('OTT Vlogger ', 'ott-vlogger') . '</span></a>' . esc_html__('By ', 'ott-vlogger') . '  <span>' . esc_html__('OMEGA ', 'ott-vlogger') . '</span>';
                                    echo esc_html__('Powered by ', 'ott-vlogger') . '<a href="' . esc_url('https://wordpress.org') . '" title="' . esc_attr__('WordPress', 'ott-vlogger') . '" target="_blank"><span>' . esc_html__('WordPress.', 'ott-vlogger') . '</span></a>';
                                 ?>
                            </div>
                        </div>
                    </div>
                    <div class="column column-3 align-text-right">
                        <a class="to-the-top" href="#site-header">
                            <span class="to-the-top-long">
                                <?php if ( get_theme_mod('ott_vlogger_enable_to_the_top', true) == true ) : ?>
                                    <?php
                                    $ott_vlogger_to_the_top_text = get_theme_mod( 'ott_vlogger_to_the_top_text', __( 'To the Top', 'ott-vlogger' ) );
                                    printf( 
                                        wp_kses( 
                                            /* translators: %s is the arrow icon markup */
                                            '%s %s', 
                                            array( 'span' => array( 'class' => array(), 'aria-hidden' => array() ) ) 
                                        ), 
                                        esc_html( $ott_vlogger_to_the_top_text ),
                                        '<span class="arrow" aria-hidden="true">&uarr;</span>' 
                                    );
                                    ?>
                                <?php endif; ?>
                            </span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    <?php
    }

endif;

add_action( 'ott_vlogger_footer_content_action','ott_vlogger_footer_content_info',20 );


if( !function_exists( 'ott_vlogger_main_slider' ) ) :

    function ott_vlogger_main_slider(){

        $ott_vlogger_footer_column_layout = ott_vlogger_get_default_theme_options();
        $ott_vlogger_header_banner = get_theme_mod( 'ott_vlogger_header_banner', $ott_vlogger_footer_column_layout['ott_vlogger_header_banner'] );
        $ott_vlogger_header_banner_cat = get_theme_mod( 'ott_vlogger_header_banner_cat','Travel' );
        $ott_vlogger_banner_right_cat = get_theme_mod( 'ott_vlogger_banner_right_cat','uncategorized' );

        if( $ott_vlogger_header_banner ){
            if( $ott_vlogger_header_banner_cat || $ott_vlogger_banner_right_cat ){ ?>
                <div class="slider-box" style="background-image: url(<?php echo esc_url(get_template_directory_uri()) ?>/assets/images/slider-bg.png)">
                    <div class="wrapper">
                        <div class="slider-main">
                            <div class="right-box">
                                <?php if( $ott_vlogger_header_banner_cat ){ ?>
                                    <?php
                                    $ott_vlogger_rtl = '';
                                    if( is_rtl() ){
                                        $ott_vlogger_rtl = 'dir="rtl"';
                                    }
                                    $ott_vlogger_banner_query = new WP_Query( array('post_type' => 'post', 'posts_per_page' => 4,'post__not_in' => get_option("sticky_posts"), 'category_name' => esc_html( $ott_vlogger_header_banner_cat ) ) );
                                    if( $ott_vlogger_banner_query->have_posts() ): ?>
                                        <div class="theme-custom-block theme-banner-block">
                                            <div class="swiper-container theme-main-carousel swiper-container" <?php echo $ott_vlogger_rtl; ?>>
                                                <div class="swiper-wrapper">
                                                    <?php
                                                        while( $ott_vlogger_banner_query->have_posts() ):
                                                        $ott_vlogger_banner_query->the_post();
                                                        $ott_vlogger_featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
                                                        $ott_vlogger_default_image = get_template_directory_uri() . '/inc/homepage-setup/assets/homepage-setup-images/slider-img1.png'; // Replace with the actual path to your default image
                                                        $ott_vlogger_featured_image = isset( $ott_vlogger_featured_image[0] ) ? $ott_vlogger_featured_image[0] : $ott_vlogger_default_image;
                                                    ?>
                                                        <div class="swiper-slide main-carousel-item">                                 
                                                            <div class="theme-article-post">
                                                                <div class="main-carousel-caption">
                                                                    <div class="post-content">
                                                                        <header class="entry-header">
                                                                            <div id="authorphoto">
                                                                                <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" rel="author"> <?php echo get_avatar( get_the_author_meta('ID')); ?></a>
                                                                                <div class="entry-author">
                                                                                    <span><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php the_author(); ?></a></span>
                                                                                    <span class="slide-cat"><?php the_category(); ?></span>
                                                                                </div>
                                                                                
                                                                            </div>
                                                                            <h2 class="entry-title">
                                                                                <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
                                                                            </h2>
                                                                            <div class="entry-content">
                                                                                <?php
                                                                                if (has_excerpt()) {

                                                                                    the_excerpt();

                                                                                } else {

                                                                                    echo esc_html(wp_trim_words(get_the_content(), 25, '...'));

                                                                                } ?>
                                                                            </div>
                                                                            <div class="meta-box">
                                                                                <span> 
                                                                                    <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V192H0v272zm320-196c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM192 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM64 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zM400 64h-48V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H160V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H48C21.5 64 0 85.5 0 112v48h448v-48c0-26.5-21.5-48-48-48z"/></svg>
                                                                                    <?php echo esc_html( get_the_date('d/m/y')) ; ?>
                                                                                </span>
                                                                                <span>
                                                                                    <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 8C119 8 8 119 8 256S119 504 256 504 504 393 504 256 393 8 256 8zm92.5 313h0l-20 25a16 16 0 0 1 -22.5 2.5h0l-67-49.7a40 40 0 0 1 -15-31.2V112a16 16 0 0 1 16-16h32a16 16 0 0 1 16 16V256l58 42.5A16 16 0 0 1 348.5 321z"/></svg>
                                                                                    <?php echo esc_html( get_the_time()) ; ?>
                                                                                </span>
                                                                                <span id='menu'>
                                                                                  <span class='Social'>
                                                                                    <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M352 320c-22.6 0-43.4 7.8-59.8 20.9l-102.5-64.1a96.6 96.6 0 0 0 0-41.7l102.5-64.1C308.6 184.2 329.4 192 352 192c53 0 96-43 96-96S405 0 352 0s-96 43-96 96c0 7.2 .8 14.1 2.3 20.8L155.8 180.9C139.4 167.8 118.6 160 96 160c-53 0-96 43-96 96s43 96 96 96c22.6 0 43.4-7.8 59.8-20.9l102.5 64.1A96.3 96.3 0 0 0 256 416c0 53 43 96 96 96s96-43 96-96-43-96-96-96z"/></svg><?php echo esc_html('Share','blog-pro'); ?>
                                                                                  </span>
                                                                                  <div class='media' id="media">
                                                                                    <span>
                                                                                        <a href="https://www.linkedin.com/sharer.php?u=<?php echo the_permalink(); ?>&title=<?php echo the_title(); ?>&source=<?php echo the_title(); ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" height="1em"viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M100.3 448H7.4V148.9h92.9zM53.8 108.1C24.1 108.1 0 83.5 0 53.8a53.8 53.8 0 0 1 107.6 0c0 29.7-24.1 54.3-53.8 54.3zM447.9 448h-92.7V302.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V448h-92.8V148.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V448z"/></svg></a>
                                                                                     
                                                                                    </span>
                                                                                    <span>
                                                                                        <a href="https://twitter.com/share?url=<?php echo the_permalink(); ?>&amp;text=<?php echo the_title(); ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg></a>
                                                                                      
                                                                                    </span>
                                                                                    <span>
                                                                                        <a href="https://www.facebook.com/sharer.php?u=<?php echo the_permalink(); ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><path d="M504 256C504 119 393 8 256 8S8 119 8 256c0 123.78 90.69 226.38 209.25 245V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.28c-30.8 0-40.41 19.12-40.41 38.73V256h68.78l-11 71.69h-57.78V501C413.31 482.38 504 379.78 504 256z"/></svg></a>
                                                                                      
                                                                                    </span>
                                                                                  </div>
                                                                                </span>
                                                                            </div>
                                                                        </header>
                                                                        <a href="<?php the_permalink(); ?>" class="btn-fancy btn-fancy-primary" tabindex="0">
                                                                            <?php echo esc_html__('Read More', 'ott-vlogger'); ?><span><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M285.5 273L91.1 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.7-22.7c-9.4-9.4-9.4-24.5 0-33.9L188.5 256 34.5 101.3c-9.3-9.4-9.3-24.5 0-33.9l22.7-22.7c9.4-9.4 24.6-9.4 33.9 0L285.5 239c9.4 9.4 9.4 24.6 0 33.9z"/></svg></span>
                                                                        </a>
                                                                    </div>
                                                                </div>
                                                                <div class="entry-thumbnail">
                                                                    <div class="data-bg data-bg-large featured-image" data-background="<?php echo esc_url($ott_vlogger_featured_image); ?>">
                                                                        <a href="<?php the_permalink(); ?>" class="theme-image-responsive" tabindex="0"></a>
                                                                    </div>
                                                                    <?php ott_vlogger_post_format_icon(); ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    <?php endwhile; ?>
                                                </div>
                                                <div class="swiper-pagination"></div>
                                            </div>
                                        </div>
                                    <?php
                                        wp_reset_postdata();
                                        endif; ?>
                                <?php }?>
                            </div>
                            <div class="main-banner">
                                <?php if( $ott_vlogger_banner_right_cat ){ ?>
                                    <div class="banner-div">
                                        <div class="main-banner-box">
                                            <?php
                                            $ott_vlogger_banner_query = new WP_Query( array('post_type' => 'post', 'posts_per_page' => -1,'post__not_in' => get_option("sticky_posts"), 'category_name' => esc_html( $ott_vlogger_banner_right_cat ) ) );
                                            if( $ott_vlogger_banner_query->have_posts() ): ?>
                                                <?php
                                                while( $ott_vlogger_banner_query->have_posts() ):
                                                $ott_vlogger_banner_query->the_post();
                                                $ott_vlogger_featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
                                                $ott_vlogger_default_image = get_template_directory_uri() . '/inc/homepage-setup/assets/homepage-setup-images/post-img1.png'; // Replace with the actual path to your default image
                                                $ott_vlogger_featured_image = isset( $ott_vlogger_featured_image[0] ) ? $ott_vlogger_featured_image[0] : $ott_vlogger_default_image;  ?>                           
                                                <div class="theme-article-post">
                                                    <div class="entry-thumbnail">
                                                        <div class="data-bg data-bg-large featured-image" data-background="<?php echo esc_url($ott_vlogger_featured_image); ?>">
                                                            <a href="<?php the_permalink(); ?>" class="theme-image-responsive" tabindex="0"></a>
                                                        </div>
                                                        <?php ott_vlogger_post_format_icon(); ?>
                                                    </div>
                                                    <div class="main-carousel-caption">
                                                        <div class="post-content">
                                                            <header class="entry-header">
                                                                <span class="slider-cat"><?php the_category(); ?></span>
                                                                <h2 class="entry-title">
                                                                    <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
                                                                </h2>
                                                            </header>
                                                            <div class="meta-box">
                                                                <span>
                                                                    <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"/></svg>
                                                                    <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php the_author(); ?></a>
                                                                </span>
                                                                <span> 
                                                                    <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V192H0v272zm320-196c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM192 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM64 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zM400 64h-48V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H160V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H48C21.5 64 0 85.5 0 112v48h448v-48c0-26.5-21.5-48-48-48z"/></svg>
                                                                    <?php echo esc_html( get_the_date('d/m/y')) ; ?>
                                                                </span>
                                                                <span id='menu'>
                                                                    <span class='Social'>
                                                                        <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M352 320c-22.6 0-43.4 7.8-59.8 20.9l-102.5-64.1a96.6 96.6 0 0 0 0-41.7l102.5-64.1C308.6 184.2 329.4 192 352 192c53 0 96-43 96-96S405 0 352 0s-96 43-96 96c0 7.2 .8 14.1 2.3 20.8L155.8 180.9C139.4 167.8 118.6 160 96 160c-53 0-96 43-96 96s43 96 96 96c22.6 0 43.4-7.8 59.8-20.9l102.5 64.1A96.3 96.3 0 0 0 256 416c0 53 43 96 96 96s96-43 96-96-43-96-96-96z"/></svg><?php echo esc_html('Share','blog-pro'); ?>
                                                                    </span>
                                                                    <div class='media' id="media">
                                                                        <span>
                                                                            <a href="https://www.linkedin.com/sharer.php?u=<?php echo the_permalink(); ?>&title=<?php echo the_title(); ?>&source=<?php echo the_title(); ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" height="1em"viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M100.3 448H7.4V148.9h92.9zM53.8 108.1C24.1 108.1 0 83.5 0 53.8a53.8 53.8 0 0 1 107.6 0c0 29.7-24.1 54.3-53.8 54.3zM447.9 448h-92.7V302.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V448h-92.8V148.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V448z"/></svg></a>
                                                                         
                                                                        </span>
                                                                        <span>
                                                                            <a href="https://twitter.com/share?url=<?php echo the_permalink(); ?>&amp;text=<?php echo the_title(); ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg></a>
                                                                          
                                                                        </span>
                                                                        <span>
                                                                            <a href="https://www.facebook.com/sharer.php?u=<?php echo the_permalink(); ?>" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc. --><path d="M504 256C504 119 393 8 256 8S8 119 8 256c0 123.78 90.69 226.38 209.25 245V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.28c-30.8 0-40.41 19.12-40.41 38.73V256h68.78l-11 71.69h-57.78V501C413.31 482.38 504 379.78 504 256z"/></svg></a>
                                                                          
                                                                        </span>
                                                                    </div>
                                                                </span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            <?php endwhile; ?>
                                                <?php
                                                wp_reset_postdata();
                                                endif;
                                            } ?>
                                        </div>
                                    </div>
                                <?php }?>
                            </div>
                        </div>
                    </div>
                </div>
     <?php }
 }

endif;

if( !function_exists( 'ott_vlogger_pricing_plans_section' ) ) :

    function ott_vlogger_pricing_plans_section(){ 

        $ott_vlogger_footer_column_layout = ott_vlogger_get_default_theme_options();
        $ott_vlogger_defaults = ott_vlogger_get_default_theme_options();


        $ott_vlogger_most_read_section_title = esc_html( get_theme_mod( 'ott_vlogger_most_read_section_title',
        $ott_vlogger_footer_column_layout['ott_vlogger_most_read_section_title'] ) );

        $ott_vlogger_about_section_author_name = esc_html( get_theme_mod( 'ott_vlogger_about_section_author_name',
        $ott_vlogger_footer_column_layout['ott_vlogger_about_section_author_name'] ) );

        $ott_vlogger_about_section_author_designation = esc_html( get_theme_mod( 'ott_vlogger_about_section_author_designation',
        $ott_vlogger_footer_column_layout['ott_vlogger_about_section_author_designation'] ) );

        $ott_vlogger_about_section_author_content = esc_html( get_theme_mod( 'ott_vlogger_about_section_author_content',
        $ott_vlogger_footer_column_layout['ott_vlogger_about_section_author_content'] ) );

        $ott_vlogger_about_section_adds_banner_content = esc_html( get_theme_mod( 'ott_vlogger_about_section_adds_banner_content',
        $ott_vlogger_footer_column_layout['ott_vlogger_about_section_adds_banner_content'] ) );

        $ott_vlogger_most_read_section_cat = get_theme_mod( 'ott_vlogger_most_read_section_cat' );

        $ott_vlogger_adds_banner_image = get_theme_mod( 'ott_vlogger_adds_banner_image', $ott_vlogger_defaults['ott_vlogger_adds_banner_image'] );

        $ott_vlogger_about_author_image = get_theme_mod( 'ott_vlogger_about_author_image' , $ott_vlogger_defaults['ott_vlogger_about_author_image'] );

        $ott_vlogger_most_read_right_section_cat = get_theme_mod( 'ott_vlogger_most_read_right_section_cat' );

        $ott_vlogger_about_section = get_theme_mod( 'ott_vlogger_about_section', $ott_vlogger_footer_column_layout['ott_vlogger_about_section'] );

        ?>

        <?php if( $ott_vlogger_about_section ){ ?>
        <div class="most-read">
            <div class="wrapper">
                <div class="most-read-div">
                    <div class="blog-main-box">
                        <div class="list-heading-main">
                            <h3 class="list-title">
                                <?php if( $ott_vlogger_most_read_section_title ){ ?>
                                    <?php echo esc_html($ott_vlogger_most_read_section_title) ?>
                                <?php } ?>
                            </h3>
                        </div>
                        <div class="main-blog-box">
                            <div class="blog-box">
                                <?php if( $ott_vlogger_about_author_image ){ ?>
                                    <img src="<?php echo esc_url( $ott_vlogger_about_author_image ); ?>" alt="Author Image">
                                <?php } ?>
                            </div>
                            <div class="middle-blog-box">
                                <h3 class="about-author-name">
                                    <?php if( $ott_vlogger_about_section_author_name ){ ?>
                                        <?php echo esc_html($ott_vlogger_about_section_author_name) ?>
                                    <?php } ?>
                                </h3>
                                <h6 class="about-author-designation">
                                    <?php if( $ott_vlogger_about_section_author_designation ){ ?>
                                        <?php echo esc_html($ott_vlogger_about_section_author_designation) ?>
                                    <?php } ?>
                                </h6>
                                <p class="about-content">
                                    <?php if( $ott_vlogger_about_section_author_content ){ ?>
                                        <?php echo esc_html($ott_vlogger_about_section_author_content) ?>
                                    <?php } ?>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="most-sidebar-box">
                        <?php if( $ott_vlogger_adds_banner_image ){ ?>
                            <img src="<?php echo esc_url( $ott_vlogger_adds_banner_image ); ?>" alt="About Us Left Image">
                        <?php } ?>
                        <div class="banner-text">
                            <h5 class="adds-text">
                                <?php if( $ott_vlogger_about_section_adds_banner_content ){ ?>
                                    <?php echo esc_html($ott_vlogger_about_section_adds_banner_content) ?>
                                <?php } ?>
                            </h5>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php }
    }

endif;

if (!function_exists('ott_vlogger_post_format_icon')):

    // Post Format Icon.
    function ott_vlogger_post_format_icon() {

        $ott_vlogger_format = get_post_format(get_the_ID()) ?: 'standard';
        $ott_vlogger_icon = '';
        $ott_vlogger_title = '';
        if( $ott_vlogger_format == 'video' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'video' );
            $ott_vlogger_title = esc_html__('Video','ott-vlogger');
        }elseif( $ott_vlogger_format == 'audio' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'audio' );
            $ott_vlogger_title = esc_html__('Audio','ott-vlogger');
        }elseif( $ott_vlogger_format == 'gallery' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'gallery' );
            $ott_vlogger_title = esc_html__('Gallery','ott-vlogger');
        }elseif( $ott_vlogger_format == 'quote' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'quote' );
            $ott_vlogger_title = esc_html__('Quote','ott-vlogger');
        }elseif( $ott_vlogger_format == 'image' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'image' );
            $ott_vlogger_title = esc_html__('Image','ott-vlogger');
        } elseif( $ott_vlogger_format == 'link' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'link' );
            $ott_vlogger_title = esc_html__('Link','ott-vlogger');
        } elseif( $ott_vlogger_format == 'status' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'status' );
            $ott_vlogger_title = esc_html__('Status','ott-vlogger');
        } elseif( $ott_vlogger_format == 'aside' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'aside' );
            $ott_vlogger_title = esc_html__('Aside','ott-vlogger');
        } elseif( $ott_vlogger_format == 'chat' ){
            $ott_vlogger_icon = ott_vlogger_get_theme_svg( 'chat' );
            $ott_vlogger_title = esc_html__('Chat','ott-vlogger');
        }
        
        if (!empty($ott_vlogger_icon)) { ?>
            <div class="theme-post-format">
                <span class="post-format-icom"><?php echo ott_vlogger_svg_escape($ott_vlogger_icon); ?></span>
                <?php if( $ott_vlogger_title ){ echo '<span class="post-format-label">'.esc_html( $ott_vlogger_title ).'</span>'; } ?>
            </div>
        <?php }
    }

endif;

if ( ! function_exists( 'ott_vlogger_svg_escape' ) ):

    /**
     * Get information about the SVG icon.
     *
     * @param string $ott_vlogger_svg_name The name of the icon.
     * @param string $group The group the icon belongs to.
     * @param string $color Color code.
     */
    function ott_vlogger_svg_escape( $ott_vlogger_input ) {

        // Make sure that only our allowed tags and attributes are included.
        $ott_vlogger_svg = wp_kses(
            $ott_vlogger_input,
            array(
                'svg'     => array(
                    'class'       => true,
                    'xmlns'       => true,
                    'width'       => true,
                    'height'      => true,
                    'viewbox'     => true,
                    'aria-hidden' => true,
                    'role'        => true,
                    'focusable'   => true,
                ),
                'path'    => array(
                    'fill'      => true,
                    'fill-rule' => true,
                    'd'         => true,
                    'transform' => true,
                ),
                'polygon' => array(
                    'fill'      => true,
                    'fill-rule' => true,
                    'points'    => true,
                    'transform' => true,
                    'focusable' => true,
                ),
            )
        );

        if ( ! $ott_vlogger_svg ) {
            return false;
        }

        return $ott_vlogger_svg;

    }

endif;

if( !function_exists( 'ott_vlogger_sanitize_sidebar_option_meta' ) ) :

    // Sidebar Option Sanitize.
    function ott_vlogger_sanitize_sidebar_option_meta( $ott_vlogger_input ){

        $ott_vlogger_metabox_options = array( 'global-sidebar','left-sidebar','right-sidebar','no-sidebar' );
        if( in_array( $ott_vlogger_input,$ott_vlogger_metabox_options ) ){

            return $ott_vlogger_input;

        }else{

            return '';

        }
    }

endif;


if( !function_exists( 'ott_vlogger_sanitize_pagination_meta' ) ) :

    // Sidebar Option Sanitize.
    function ott_vlogger_sanitize_pagination_meta( $ott_vlogger_input ){

        $ott_vlogger_metabox_options = array( 'Center','Right','Left');
        if( in_array( $ott_vlogger_input,$ott_vlogger_metabox_options ) ){

            return $ott_vlogger_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'ott_vlogger_sanitize_menu_transform' ) ) :

    // Sidebar Option Sanitize.
    function ott_vlogger_sanitize_menu_transform( $ott_vlogger_input ){

        $ott_vlogger_metabox_options = array( 'capitalize','uppercase','lowercase');
        if( in_array( $ott_vlogger_input,$ott_vlogger_metabox_options ) ){

            return $ott_vlogger_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'ott_vlogger_sanitize_page_content_alignment' ) ) :

    // Sidebar Option Sanitize.
    function ott_vlogger_sanitize_page_content_alignment( $ott_vlogger_input ){

        $ott_vlogger_metabox_options = array( 'left','center','right');
        if( in_array( $ott_vlogger_input,$ott_vlogger_metabox_options ) ){

            return $ott_vlogger_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'ott_vlogger_sanitize_footer_widget_title_alignment' ) ) :

    // Footer Option Sanitize.
    function ott_vlogger_sanitize_footer_widget_title_alignment( $ott_vlogger_input ){

        $ott_vlogger_metabox_options = array( 'left','center','right');
        if( in_array( $ott_vlogger_input,$ott_vlogger_metabox_options ) ){

            return $ott_vlogger_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'ott_vlogger_sanitize_pagination_type' ) ) :

    /**
     * Sanitize the pagination type setting.
     *
     * @param string $ott_vlogger_input The input value from the Customizer.
     * @return string The sanitized value.
     */
    function ott_vlogger_sanitize_pagination_type( $ott_vlogger_input ) {
        // Define valid options for the pagination type.
        $ott_vlogger_valid_options = array( 'numeric', 'newer_older' ); // Update valid options to include 'newer_older'

        // If the input is one of the valid options, return it. Otherwise, return the default option ('numeric').
        if ( in_array( $ott_vlogger_input, $ott_vlogger_valid_options, true ) ) {
            return $ott_vlogger_input;
        } else {
            // Return 'numeric' as the fallback if the input is invalid.
            return 'numeric';
        }
    }

endif;


// Sanitize the enable/disable setting for pagination
if( !function_exists('ott_vlogger_sanitize_enable_pagination') ) :
    function ott_vlogger_sanitize_enable_pagination( $ott_vlogger_input ) {
        return (bool) $ott_vlogger_input;
    }
endif;

if( !function_exists( 'ott_vlogger_sanitize_copyright_alignment_meta' ) ) :

    // Sidebar Option Sanitize.
    function ott_vlogger_sanitize_copyright_alignment_meta( $ott_vlogger_input ){

        $ott_vlogger_metabox_options = array( 'Default','Reverse','Center');
        if( in_array( $ott_vlogger_input,$ott_vlogger_metabox_options ) ){

            return $ott_vlogger_input;

        }else{

            return '';

        }
    }

endif;

/**
 * Sidebar Layout Function
 */
function ott_vlogger_get_final_sidebar_layout() {
	$ott_vlogger_defaults       = ott_vlogger_get_default_theme_options();
	$ott_vlogger_global_layout  = get_theme_mod('ott_vlogger_global_sidebar_layout', $ott_vlogger_defaults['ott_vlogger_global_sidebar_layout']);
	$ott_vlogger_page_layout    = get_theme_mod('ott_vlogger_page_sidebar_layout', $ott_vlogger_global_layout);
	$ott_vlogger_post_layout    = get_theme_mod('ott_vlogger_post_sidebar_layout', $ott_vlogger_global_layout);
	$ott_vlogger_meta_layout    = get_post_meta(get_the_ID(), 'ott_vlogger_post_sidebar_option', true);

	if (!empty($ott_vlogger_meta_layout) && $ott_vlogger_meta_layout !== 'default') {
		return $ott_vlogger_meta_layout;
	}
	if (is_page() || (function_exists('is_shop') && is_shop())) {
		return $ott_vlogger_page_layout;
	}
	if (is_single()) {
		return $ott_vlogger_post_layout;
	}
	return $ott_vlogger_global_layout;
}