<?php
/**
 * Custom Functions.
 *
 * @package Car Booking
 */

if( !function_exists( 'car_booking_fonts_url' ) ) :

    //Google Fonts URL
    function car_booking_fonts_url(){

        $car_booking_font_families = array(
            'Saira:ital,wght@0,100..900;1,100..900',
            'Work+Sans:ital,wght@0,100..900;1,100..900',
        );

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

        return esc_url_raw($car_booking_fonts_url);
    }

endif;

if ( ! function_exists( 'car_booking_sub_menu_toggle_button' ) ) :

    function car_booking_sub_menu_toggle_button( $car_booking_args, $car_booking_item, $depth ) {

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

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

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

                // Add the sub menu toggle
                $car_booking_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', 'car-booking' ) . '</span>' . car_booking_get_theme_svg( 'chevron-down' ) . '</span></button>';

            }

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

        }elseif( $car_booking_args->theme_location == 'car-booking-primary-menu' ) {

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

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

            } else {

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

            }

        }

        return $car_booking_args;

    }

endif;

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

if ( ! function_exists( 'car_booking_the_theme_svg' ) ):
    
    function car_booking_the_theme_svg( $car_booking_svg_name, $car_booking_return = false ) {

        if( $car_booking_return ){

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

        }else{

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

        }
    }

endif;

if ( ! function_exists( 'car_booking_get_theme_svg' ) ):

    function car_booking_get_theme_svg( $car_booking_svg_name ) {

        // Make sure that only our allowed tags and attributes are included.
        $car_booking_svg = wp_kses(
            car_booking_SVG_Icons::get_svg( $car_booking_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 ( ! $car_booking_svg ) {
            return false;
        }
        return $car_booking_svg;

    }

endif;

if( !function_exists( 'car_booking_post_category_list' ) ) :

    // Post Category List.
    function car_booking_post_category_list( $car_booking_select_cat = true ){

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

        $car_booking_post_cat_cat_array = array();
        if( $car_booking_select_cat ){

            $car_booking_post_cat_cat_array[''] = esc_html__( '-- Select Category --','car-booking' );

        }

        foreach ( $car_booking_post_cat_lists as $car_booking_post_cat_list ) {

            $car_booking_post_cat_cat_array[$car_booking_post_cat_list->slug] = $car_booking_post_cat_list->name;

        }

        return $car_booking_post_cat_cat_array;
    }

endif;

if( !function_exists('car_booking_single_post_navigation') ):

    function car_booking_single_post_navigation(){

        $car_booking_default = car_booking_get_default_theme_options();
        $car_booking_twp_navigation_type = esc_attr( get_post_meta( get_the_ID(), 'twp_disable_ajax_load_next_post', true ) );
        $car_booking_current_id = '';
        $article_wrap_class = '';
        global $post;
        $car_booking_current_id = $post->ID;
        if( $car_booking_twp_navigation_type == '' || $car_booking_twp_navigation_type == 'global-layout' ){
            $car_booking_twp_navigation_type = get_theme_mod('twp_navigation_type', $car_booking_default['twp_navigation_type']);
        }

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

            if( $car_booking_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">' . car_booking_the_theme_svg('arrow-left',$car_booking_return = true ) . '</span><span class="screen-reader-text">' . esc_html__('Previous post:', 'car-booking') . '</span><span class="post-title">%title</span>',
                        'next_text' => '<span class="arrow" aria-hidden="true">' . car_booking_the_theme_svg('arrow-right',$car_booking_return = true ) . '</span><span class="screen-reader-text">' . esc_html__('Next post:', 'car-booking') . '</span><span class="post-title">%title</span>',
                    )); ?>
                </div>
                <?php

            }else{

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

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

                }
            }

        }

    }

endif;

add_action( 'car_booking_navigation_action','car_booking_single_post_navigation',30 );

if( !function_exists('car_booking_content_offcanvas') ):

    // Offcanvas Contents
    function car_booking_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', 'car-booking'); ?>
                            </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', 'car-booking'); ?>" role="navigation">
                        <ul class="primary-menu theme-menu">
                            <?php
                            if (has_nav_menu('car-booking-primary-menu')) {
                                wp_nav_menu(
                                    array(
                                        'container' => '',
                                        'items_wrap' => '%3$s',
                                        'theme_location' => 'car-booking-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 Car_Booking_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( 'car_booking_before_footer_content_action','car_booking_content_offcanvas',30 );

if( !function_exists('car_booking_footer_content_widget') ):

    function car_booking_footer_content_widget(){
        
        $car_booking_default = car_booking_get_default_theme_options();
        
        $car_booking_footer_column_layout = absint(get_theme_mod('car_booking_footer_column_layout', $car_booking_default['car_booking_footer_column_layout']));
        $car_booking_footer_sidebar_class = 12;
        
        if($car_booking_footer_column_layout == 2) {
            $car_booking_footer_sidebar_class = 6;
        }
        
        if($car_booking_footer_column_layout == 3) {
            $car_booking_footer_sidebar_class = 4;
        }
        ?>
        
        <?php if ( get_theme_mod('car_booking_display_footer', true) == true ) : ?>
            <div class="footer-widgetarea">
                <div class="wrapper">
                    <div class="column-row">
                    
                        <?php for ($i = 0; $i < $car_booking_footer_column_layout; $i++) : ?>
                            
                            <div class="column <?php echo 'column-' . absint($car_booking_footer_sidebar_class); ?> column-sm-12">
                                
                                <?php 
                                // If no widgets are assigned, display default widgets
                                if ( ! is_active_sidebar( 'car-booking-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', 'car-booking' ); ?>" 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('The Car Booking WordPress Theme is a powerful, feature-rich solution designed for car rental services, auto dealerships, and vehicle marketplaces. Whether you run a car rental agency, auto car dealer business, or luxury car rental service, this theme provides a seamless online experience for both customers and business owners. Built with a sleek, modern design, this theme offers intuitive navigation, high-resolution image galleries, and an interactive booking system.', 'car-booking'); ?>
                                                </p>
                                            </div>
                                        </div>

                                    <?php elseif ($i === 1) : ?>
                                        <div id="pages-2" class="widget widget_pages">
                                            <h2 class="widget-title"><?php esc_html_e('Calendar', 'car-booking'); ?></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', 'car-booking'); ?></h2>
                                            <?php get_search_form(); ?>
                                        </div>
                                    <?php endif; 
                                    
                                else :
                                    // Display dynamic sidebar widget if assigned
                                    dynamic_sidebar('car-booking-footer-widget-' . $i);
                                endif;
                                ?>
                                
                            </div>
                            
                        <?php endfor; ?>

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

    <?php
    }

endif;

add_action( 'car_booking_footer_content_action', 'car_booking_footer_content_widget', 10 );

if( !function_exists('car_booking_footer_content_info') ):

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

        $car_booking_default = car_booking_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
                                $car_booking_footer_copyright_text = wp_kses_post( get_theme_mod( 'car_booking_footer_copyright_text', $car_booking_default['car_booking_footer_copyright_text'] ) );
                                    echo esc_html( $car_booking_footer_copyright_text );
                                    echo '<br>';
                                    echo esc_html__('Theme: ', 'car-booking') . '<a href="' . esc_url('https://www.omegathemes.com/products/free-car-booking-wordpress-theme') . '" title="' . esc_attr__('Car Booking', 'car-booking') . '" target="_blank"><span>' . esc_html__('Car Booking ', 'car-booking') . '</span></a>' . esc_html__(' By ', 'car-booking') . '  <span>' . esc_html__('OMEGA ', 'car-booking') . '</span>';
                                    echo esc_html__('Powered by ', 'car-booking') . '<a href="' . esc_url('https://wordpress.org') . '" title="' . esc_attr__('WordPress', 'car-booking') . '" target="_blank"><span>' . esc_html__('WordPress.', 'car-booking') . '</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('car_booking_enable_to_the_top', true) == true ) : ?>
                                    <?php
                                    $car_booking_to_the_top_text = get_theme_mod( 'car_booking_to_the_top_text', __( 'To the Top', 'car-booking' ) );
                                    printf( 
                                        wp_kses( 
                                            /* translators: %s is the arrow icon markup */
                                            '%s %s', 
                                            array( 'span' => array( 'class' => array(), 'aria-hidden' => array() ) ) 
                                        ), 
                                        esc_html( $car_booking_to_the_top_text ),
                                        '<span class="arrow" aria-hidden="true">&uarr;</span>' 
                                    );
                                    ?>
                                <?php endif; ?>
                            </span>
                        </a>

                    </div>
                </div>
            </div>
        </div>

    <?php
    }

endif;

add_action( 'car_booking_footer_content_action','car_booking_footer_content_info',20 );


if( !function_exists( 'car_booking_main_slider' ) ) :

    function car_booking_main_slider(){

        $car_booking_defaults = car_booking_get_default_theme_options();
        $car_booking_header_banner = get_theme_mod( 'car_booking_header_banner', $car_booking_defaults['car_booking_header_banner'] );
        $car_booking_header_banner_cat = get_theme_mod( 'car_booking_header_banner_cat' );

        if( $car_booking_header_banner ){

            $car_booking_rtl = '';
            if( is_rtl() ){
                $car_booking_rtl = 'dir="rtl"';
            }

            $car_booking_banner_query = new WP_Query( array('post_type' => 'post', 'posts_per_page' => 4,'post__not_in' => get_option("sticky_posts"), 'category_name' => esc_html( $car_booking_header_banner_cat ) ) );
            $car_booking_slider_section_short_title = get_theme_mod( 'car_booking_slider_section_short_title', 
            $car_booking_defaults['car_booking_slider_section_short_title'] );
            $car_booking_banner_background_image = get_theme_mod( 'car_booking_banner_background_image', 
            $car_booking_defaults['car_booking_banner_background_image'] );
            $car_booking_contact_form_shortcode = get_theme_mod( 'car_booking_contact_form_shortcode' );

          if( $car_booking_banner_query->have_posts() ): ?>

            <div class="theme-custom-block theme-banner-block" style="background: url(<?php echo esc_url( $car_booking_banner_background_image ); ?>);">
                <div class="slider-box">
                    <div class="wrapper">
                        <div class="swiper-container theme-main-carousel swiper-container" <?php echo $car_booking_rtl; ?>>
                            <div class="swiper-wrapper">
                              <?php
                              while( $car_booking_banner_query->have_posts() ):
                                $car_booking_banner_query->the_post();
                                $car_booking_featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
                                $car_booking_default_image = get_template_directory_uri() . '/inc/homepage-setup/assets/homepage-setup-images/banner1.png'; // Replace with the actual path to your default image
                                $car_booking_featured_image = isset( $car_booking_featured_image[0] ) ? $car_booking_featured_image[0] : $car_booking_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">
                                                    <h2 class="entry-title entry-title-big">
                                                        <a href="<?php the_permalink(); ?>" rel="bookmark"><span><?php the_title(); ?></span></a>
                                                    </h2>
                                                </header>
                                                <div class="entry-content">
                                                    <?php
                                                        if (has_excerpt()) {

                                                            the_excerpt();

                                                        } else {

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

                                                    } ?>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="entry-thumbnail">
                                            <div class="data-bg data-bg-medium" data-background="<?php echo esc_url($car_booking_featured_image); ?>">
                                                <a href="<?php the_permalink(); ?>" class="theme-image-responsive" tabindex="0"></a>
                                            </div>
                                          <?php car_booking_post_format_icon(); ?>
                                        </div>
                                    </div>
                                </div>
                              <?php endwhile; ?>
                            </div>
                            <div class="swiper-pagination"></div>                  
                        </div>
                    </div>
                </div>
                <?php if( $car_booking_contact_form_shortcode ){ ?>
                    <div class="form-shortcode">
                        <div class="wrapper">
                            <?php echo do_shortcode( $car_booking_contact_form_shortcode ); ?>
                        </div>
                    </div>
                <?php }?>
            </div>

          <?php
          wp_reset_postdata();
          endif;

        }

    }

endif;

if (!function_exists('car_booking_post_format_icon')):

    // Post Format Icon.
    function car_booking_post_format_icon() {

        $car_booking_format = get_post_format(get_the_ID()) ?: 'standard';
        $car_booking_icon = '';
        $car_booking_title = '';
        if( $car_booking_format == 'video' ){
            $car_booking_icon = car_booking_get_theme_svg( 'video' );
            $car_booking_title = esc_html__('Video','car-booking');
        }elseif( $car_booking_format == 'audio' ){
            $car_booking_icon = car_booking_get_theme_svg( 'audio' );
            $car_booking_title = esc_html__('Audio','car-booking');
        }elseif( $car_booking_format == 'gallery' ){
            $car_booking_icon = car_booking_get_theme_svg( 'gallery' );
            $car_booking_title = esc_html__('Gallery','car-booking');
        }elseif( $car_booking_format == 'quote' ){
            $car_booking_icon = car_booking_get_theme_svg( 'quote' );
            $car_booking_title = esc_html__('Quote','car-booking');
        }elseif( $car_booking_format == 'image' ){
            $car_booking_icon = car_booking_get_theme_svg( 'image' );
            $car_booking_title = esc_html__('Image','car-booking');
        } elseif( $car_booking_format == 'link' ){
            $car_booking_icon = car_booking_get_theme_svg( 'link' );
            $car_booking_title = esc_html__('Link','car-booking');
        } elseif( $car_booking_format == 'status' ){
            $car_booking_icon = car_booking_get_theme_svg( 'status' );
            $car_booking_title = esc_html__('Status','car-booking');
        } elseif( $car_booking_format == 'aside' ){
            $car_booking_icon = car_booking_get_theme_svg( 'aside' );
            $car_booking_title = esc_html__('Aside','car-booking');
        } elseif( $car_booking_format == 'chat' ){
            $car_booking_icon = car_booking_get_theme_svg( 'chat' );
            $car_booking_title = esc_html__('Chat','car-booking');
        }
        
        if (!empty($car_booking_icon)) { ?>
            <div class="theme-post-format">
                <span class="post-format-icom"><?php echo car_booking_svg_escape($car_booking_icon); ?></span>
                <?php if( $car_booking_title ){ echo '<span class="post-format-label">'.esc_html( $car_booking_title ).'</span>'; } ?>
            </div>
        <?php }
    }

endif;

if ( ! function_exists( 'car_booking_svg_escape' ) ):

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

        // Make sure that only our allowed tags and attributes are included.
        $car_booking_svg = wp_kses(
            $car_booking_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 ( ! $car_booking_svg ) {
            return false;
        }

        return $car_booking_svg;

    }

endif;

if( !function_exists( 'car_booking_sanitize_sidebar_option_meta' ) ) :

    // Sidebar Option Sanitize.
    function car_booking_sanitize_sidebar_option_meta( $car_booking_input ){

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

            return $car_booking_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'car_booking_sanitize_pagination_meta' ) ) :

    // Sidebar Option Sanitize.
    function car_booking_sanitize_pagination_meta( $car_booking_input ){

        $car_booking_metabox_options = array( 'Center','Right','Left');
        if( in_array( $car_booking_input,$car_booking_metabox_options ) ){

            return $car_booking_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'car_booking_aboutus_slider' ) ) :

    function car_booking_aboutus_slider(){

        $car_booking_defaults = car_booking_get_default_theme_options();
        $car_booking_services = get_theme_mod( 'car_booking_services', $car_booking_defaults['car_booking_services'] );

        $car_booking_services_section_title = get_theme_mod( 'car_booking_services_section_title', 
        $car_booking_defaults['car_booking_services_section_title'] );

        $car_booking_services_section_short_title = get_theme_mod( 'car_booking_services_section_short_title', 
        $car_booking_defaults['car_booking_services_section_short_title'] );

        // Product 1

        $car_booking_product_image_1 = get_theme_mod( 'car_booking_product_image_1', 
        $car_booking_defaults['car_booking_product_image_1'] );
        $car_booking_product_vehicle_heading_1 = get_theme_mod( 'car_booking_product_vehicle_heading_1', 
        $car_booking_defaults['car_booking_product_vehicle_heading_1'] );
        $car_booking_product_vehicle_power_heading_1 = get_theme_mod( 'car_booking_product_vehicle_power_heading_1', 
        $car_booking_defaults['car_booking_product_vehicle_power_heading_1'] );
        $car_booking_product_vehicle_engine_1 = get_theme_mod( 'car_booking_product_vehicle_engine_1', 
        $car_booking_defaults['car_booking_product_vehicle_engine_1'] );
        $car_booking_product_vehicle_fuel_heading_1_box_1 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_1_box_1', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_1_box_1'] );
        $car_booking_product_vehicle_fuel_heading_2_box_1 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_2_box_1', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_2_box_1'] );
        $car_booking_product_vehicle_speed_1 = get_theme_mod( 'car_booking_product_vehicle_speed_1', 
        $car_booking_defaults['car_booking_product_vehicle_speed_1'] );
        $car_booking_product_vehicle_speed_text_1 = get_theme_mod( 'car_booking_product_vehicle_speed_text_1', 
        $car_booking_defaults['car_booking_product_vehicle_speed_text_1'] );
        $car_booking_product_vehicle_discription_1 = get_theme_mod( 'car_booking_product_vehicle_discription_1', 
        $car_booking_defaults['car_booking_product_vehicle_discription_1'] );
        $car_booking_product_button_text_1 = get_theme_mod( 'car_booking_product_button_text_1', 
        $car_booking_defaults['car_booking_product_button_text_1'] );
        $car_booking_product_button_link_1 = get_theme_mod( 'car_booking_product_button_link_1', 
        $car_booking_defaults['car_booking_product_button_link_1'] );
        $car_booking_product_vehicle_price_1 = get_theme_mod( 'car_booking_product_vehicle_price_1', 
        $car_booking_defaults['car_booking_product_vehicle_price_1'] );

        // Product 2

        $car_booking_product_image_2 = get_theme_mod( 'car_booking_product_image_2', 
        $car_booking_defaults['car_booking_product_image_2'] );
        $car_booking_product_vehicle_heading_2 = get_theme_mod( 'car_booking_product_vehicle_heading_2', 
        $car_booking_defaults['car_booking_product_vehicle_heading_2'] );
        $car_booking_product_vehicle_power_heading_2 = get_theme_mod( 'car_booking_product_vehicle_power_heading_2', 
        $car_booking_defaults['car_booking_product_vehicle_power_heading_2'] );
        $car_booking_product_vehicle_engine_2 = get_theme_mod( 'car_booking_product_vehicle_engine_2', 
        $car_booking_defaults['car_booking_product_vehicle_engine_2'] );
        $car_booking_product_vehicle_fuel_heading_1_box_2 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_1_box_2', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_1_box_2'] );
        $car_booking_product_vehicle_fuel_heading_2_box_2 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_2_box_2', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_2_box_2'] );
        $car_booking_product_vehicle_speed_2 = get_theme_mod( 'car_booking_product_vehicle_speed_2', 
        $car_booking_defaults['car_booking_product_vehicle_speed_2'] );
        $car_booking_product_vehicle_speed_text_2 = get_theme_mod( 'car_booking_product_vehicle_speed_text_2', 
        $car_booking_defaults['car_booking_product_vehicle_speed_text_2'] );
        $car_booking_product_vehicle_discription_2 = get_theme_mod( 'car_booking_product_vehicle_discription_2', 
        $car_booking_defaults['car_booking_product_vehicle_discription_2'] );
        $car_booking_product_button_text_2 = get_theme_mod( 'car_booking_product_button_text_2', 
        $car_booking_defaults['car_booking_product_button_text_2'] );
        $car_booking_product_button_link_2 = get_theme_mod( 'car_booking_product_button_link_2', 
        $car_booking_defaults['car_booking_product_button_link_2'] );
        $car_booking_product_vehicle_price_2 = get_theme_mod( 'car_booking_product_vehicle_price_2', 
        $car_booking_defaults['car_booking_product_vehicle_price_2'] );

        // Product 3

        $car_booking_product_image_3 = get_theme_mod( 'car_booking_product_image_3', 
        $car_booking_defaults['car_booking_product_image_3'] );
        $car_booking_product_vehicle_heading_3 = get_theme_mod( 'car_booking_product_vehicle_heading_3', 
        $car_booking_defaults['car_booking_product_vehicle_heading_3'] );
        $car_booking_product_vehicle_power_heading_3 = get_theme_mod( 'car_booking_product_vehicle_power_heading_3', 
        $car_booking_defaults['car_booking_product_vehicle_power_heading_3'] );
        $car_booking_product_vehicle_engine_3 = get_theme_mod( 'car_booking_product_vehicle_engine_3', 
        $car_booking_defaults['car_booking_product_vehicle_engine_3'] );
        $car_booking_product_vehicle_fuel_heading_1_box_3 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_1_box_3', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_1_box_3'] );
        $car_booking_product_vehicle_fuel_heading_2_box_3 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_2_box_3', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_2_box_3'] );
        $car_booking_product_vehicle_speed_3 = get_theme_mod( 'car_booking_product_vehicle_speed_3', 
        $car_booking_defaults['car_booking_product_vehicle_speed_3'] );
        $car_booking_product_vehicle_speed_text_3 = get_theme_mod( 'car_booking_product_vehicle_speed_text_3', 
        $car_booking_defaults['car_booking_product_vehicle_speed_text_3'] );
        $car_booking_product_vehicle_discription_3 = get_theme_mod( 'car_booking_product_vehicle_discription_3', 
        $car_booking_defaults['car_booking_product_vehicle_discription_3'] );
        $car_booking_product_button_text_3 = get_theme_mod( 'car_booking_product_button_text_3', 
        $car_booking_defaults['car_booking_product_button_text_3'] );
        $car_booking_product_button_link_3 = get_theme_mod( 'car_booking_product_button_link_3', 
        $car_booking_defaults['car_booking_product_button_link_3'] );
        $car_booking_product_vehicle_price_3 = get_theme_mod( 'car_booking_product_vehicle_price_3', 
        $car_booking_defaults['car_booking_product_vehicle_price_3'] );

        // Product 4

        $car_booking_product_image_4 = get_theme_mod( 'car_booking_product_image_4', 
        $car_booking_defaults['car_booking_product_image_4'] );
        $car_booking_product_vehicle_heading_4 = get_theme_mod( 'car_booking_product_vehicle_heading_4', 
        $car_booking_defaults['car_booking_product_vehicle_heading_4'] );
        $car_booking_product_vehicle_power_heading_4 = get_theme_mod( 'car_booking_product_vehicle_power_heading_4', 
        $car_booking_defaults['car_booking_product_vehicle_power_heading_4'] );
        $car_booking_product_vehicle_engine_4 = get_theme_mod( 'car_booking_product_vehicle_engine_4', 
        $car_booking_defaults['car_booking_product_vehicle_engine_4'] );
        $car_booking_product_vehicle_fuel_heading_1_box_4 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_1_box_4', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_1_box_4'] );
        $car_booking_product_vehicle_fuel_heading_2_box_4 = get_theme_mod( 'car_booking_product_vehicle_fuel_heading_2_box_4', 
        $car_booking_defaults['car_booking_product_vehicle_fuel_heading_2_box_4'] );
        $car_booking_product_vehicle_speed_4 = get_theme_mod( 'car_booking_product_vehicle_speed_4', 
        $car_booking_defaults['car_booking_product_vehicle_speed_4'] );
        $car_booking_product_vehicle_speed_text_4 = get_theme_mod( 'car_booking_product_vehicle_speed_text_4', 
        $car_booking_defaults['car_booking_product_vehicle_speed_text_4'] );
        $car_booking_product_vehicle_discription_4 = get_theme_mod( 'car_booking_product_vehicle_discription_4', 
        $car_booking_defaults['car_booking_product_vehicle_discription_4'] );
        $car_booking_product_button_text_4 = get_theme_mod( 'car_booking_product_button_text_4', 
        $car_booking_defaults['car_booking_product_button_text_4'] );
        $car_booking_product_button_link_4 = get_theme_mod( 'car_booking_product_button_link_4', 
        $car_booking_defaults['car_booking_product_button_link_4'] );
        $car_booking_product_vehicle_price_4 = get_theme_mod( 'car_booking_product_vehicle_price_4', 
        $car_booking_defaults['car_booking_product_vehicle_price_4'] );
        
        if( $car_booking_services ){ ?>
        <div class="theme-product-block">
            <div class="wrapper">
                <div class="section-content">
                    <?php if( $car_booking_services_section_short_title ){ ?>
                        <h6><?php echo esc_html( $car_booking_services_section_short_title ); ?></h6>
                    <?php } ?>

                    <?php if( $car_booking_services_section_title ){ ?>
                        <h2><?php echo esc_html( $car_booking_services_section_title ); ?></h2>
                    <?php } ?>
                </div>
                <div class="main-tab">
                    <div class="tab">
                        <div class="tab-content">
                            <button class="tablinks" onclick="car_booking_product_tab_section(event, 'product1')">
                                <?php if( $car_booking_product_image_1 ){ ?>
                                   <img src="<?php echo esc_url( $car_booking_product_image_1 ); ?>"> 
                                <?php } ?>
                            </button>
                            <?php if( $car_booking_product_vehicle_heading_1 ){ ?>
                                <h3><?php echo esc_html( $car_booking_product_vehicle_heading_1 ); ?></h3>
                            <?php } ?>  
                        </div>
                        <div class="tab-content">
                            <button class="tablinks" onclick="car_booking_product_tab_section(event, 'product2')">
                                <?php if( $car_booking_product_image_2 ){ ?>
                                   <img src="<?php echo esc_url( $car_booking_product_image_2 ); ?>"> 
                                <?php } ?>
                            </button>
                            <?php if( $car_booking_product_vehicle_heading_2 ){ ?>
                                <h3><?php echo esc_html( $car_booking_product_vehicle_heading_2 ); ?></h3>
                            <?php } ?>
                        </div>
                    </div>
                    <div class="tab-area">
                        <div id="product1" class="tabcontent">
                            <div class="product-main-box">
                                <div class="product-heading">
                                    <div class="product-left">
                                        <div class="box-1">
                                            <?php if( $car_booking_product_vehicle_power_heading_1 ){ ?>
                                                <h6 class="heading1"><?php echo esc_html( $car_booking_product_vehicle_power_heading_1 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_engine_1 ){ ?>
                                                <h6 class="heading2"><?php echo esc_html( $car_booking_product_vehicle_engine_1 ); ?></h6>
                                            <?php } ?>
                                        </div>
                                        <div class="box-2">
                                            <div class="fuel-btn">
                                                <?php if( $car_booking_product_vehicle_fuel_heading_1_box_1){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_1_box_1 ); ?></span>
                                                <?php } ?>
                                                <?php if( $car_booking_product_vehicle_fuel_heading_2_box_1 ){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_2_box_1 ); ?></span>
                                                <?php } ?>
                                            </div>
                                            <?php if( $car_booking_product_vehicle_speed_1 ){ ?>
                                                <h6><?php echo esc_html( $car_booking_product_vehicle_speed_1 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_speed_text_1 ){ ?>
                                                <p><?php echo esc_html( $car_booking_product_vehicle_speed_text_1 ); ?></p>
                                            <?php } ?>
                                        </div>
                                    </div>
                                    <div class="product-right">
                                        <div class="product-image-box">
                                            <?php if( $car_booking_product_image_1 ){ ?>
                                               <img src="<?php echo esc_url( $car_booking_product_image_1 ); ?>"> 
                                            <?php } ?>
                                            
                                        </div>
                                    </div>
                                </div>
                                <?php if( $car_booking_product_vehicle_discription_1 ){ ?>
                                    <p class="product-text"><?php echo esc_html( $car_booking_product_vehicle_discription_1 ); ?></p>
                                <?php } ?>
                                <?php if( $car_booking_product_button_text_1 ){ ?>
                                    <a class="product-button" href="<?php echo esc_url( $car_booking_product_button_link_1 ); ?>"><?php echo esc_html( $car_booking_product_button_text_1 ); ?><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 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></a>
                                <?php } ?>
                                <?php if( $car_booking_product_vehicle_price_1 ){ ?>
                                    <span class="price-box"><?php echo esc_html( $car_booking_product_vehicle_price_1 ); ?></span>
                                <?php } ?>
                            </div>
                        </div>
                        <div id="product2" class="tabcontent">
                            <div class="product-main-box">
                                <div class="product-heading">
                                    <div class="product-left">
                                        <div class="box-1">
                                            <?php if( $car_booking_product_vehicle_power_heading_2 ){ ?>
                                                <h6 class="heading1"><?php echo esc_html( $car_booking_product_vehicle_power_heading_2 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_engine_2 ){ ?>
                                                <h6 class="heading2"><?php echo esc_html( $car_booking_product_vehicle_engine_2 ); ?></h6>
                                            <?php } ?>
                                        </div>
                                        <div class="box-2">
                                            <div class="fuel-btn">
                                                <?php if( $car_booking_product_vehicle_fuel_heading_1_box_2){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_1_box_2 ); ?></span>
                                                <?php } ?>
                                                <?php if( $car_booking_product_vehicle_fuel_heading_2_box_2 ){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_2_box_2 ); ?></span>
                                                <?php } ?>
                                            </div>
                                            <?php if( $car_booking_product_vehicle_speed_2 ){ ?>
                                                <h6><?php echo esc_html( $car_booking_product_vehicle_speed_2 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_speed_text_2 ){ ?>
                                                <p><?php echo esc_html( $car_booking_product_vehicle_speed_text_2 ); ?></p>
                                            <?php } ?>
                                        </div>
                                    </div>
                                    <div class="product-right">
                                        <div class="product-image-box">
                                            <?php if( $car_booking_product_image_2 ){ ?>
                                               <img src="<?php echo esc_url( $car_booking_product_image_2 ); ?>"> 
                                            <?php } ?>
                                            
                                        </div>
                                    </div>
                                </div>
                                <?php if( $car_booking_product_vehicle_discription_2 ){ ?>
                                    <p class="product-text"><?php echo esc_html( $car_booking_product_vehicle_discription_2 ); ?></p>
                                <?php } ?>
                                <?php if( $car_booking_product_button_text_2 ){ ?>
                                    <a class="product-button" href="<?php echo esc_url( $car_booking_product_button_link_2 ); ?>"><?php echo esc_html( $car_booking_product_button_text_2 ); ?><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 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></a>
                                <?php } ?>
                                <?php if( $car_booking_product_vehicle_price_2 ){ ?>
                                    <span class="price-box"><?php echo esc_html( $car_booking_product_vehicle_price_2 ); ?></span>
                                <?php } ?>
                            </div>
                        </div>

                        <div id="product3" class="tabcontent">
                            <div class="product-main-box">
                                <div class="product-heading">
                                    <div class="product-left">
                                        <div class="box-1">
                                            <?php if( $car_booking_product_vehicle_power_heading_3 ){ ?>
                                                <h6 class="heading1"><?php echo esc_html( $car_booking_product_vehicle_power_heading_3 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_engine_3 ){ ?>
                                                <h6 class="heading2"><?php echo esc_html( $car_booking_product_vehicle_engine_3 ); ?></h6>
                                            <?php } ?>
                                        </div>
                                        <div class="box-2">
                                            <div class="fuel-btn">
                                                <?php if( $car_booking_product_vehicle_fuel_heading_1_box_3){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_1_box_3 ); ?></span>
                                                <?php } ?>
                                                <?php if( $car_booking_product_vehicle_fuel_heading_2_box_3 ){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_2_box_3 ); ?></span>
                                                <?php } ?>
                                            </div>
                                            <?php if( $car_booking_product_vehicle_speed_3 ){ ?>
                                                <h6><?php echo esc_html( $car_booking_product_vehicle_speed_3 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_speed_text_3 ){ ?>
                                                <p><?php echo esc_html( $car_booking_product_vehicle_speed_text_3 ); ?></p>
                                            <?php } ?>
                                        </div>
                                    </div>
                                    <div class="product-right">
                                        <div class="product-image-box">
                                            <?php if( $car_booking_product_image_3 ){ ?>
                                               <img src="<?php echo esc_url( $car_booking_product_image_3 ); ?>"> 
                                            <?php } ?>
                                            
                                        </div>
                                    </div>
                                </div>
                                <?php if( $car_booking_product_vehicle_discription_3 ){ ?>
                                    <p class="product-text"><?php echo esc_html( $car_booking_product_vehicle_discription_3 ); ?></p>
                                <?php } ?>
                                <?php if( $car_booking_product_button_text_3 ){ ?>
                                    <a class="product-button" href="<?php echo esc_url( $car_booking_product_button_link_3 ); ?>"><?php echo esc_html( $car_booking_product_button_text_3 ); ?><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 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></a>
                                <?php } ?>
                                <?php if( $car_booking_product_vehicle_price_3 ){ ?>
                                    <span class="price-box"><?php echo esc_html( $car_booking_product_vehicle_price_3 ); ?></span>
                                <?php } ?>
                            </div>
                        </div>
                        <div id="product4" class="tabcontent">
                            <div class="product-main-box">
                                <div class="product-heading">
                                    <div class="product-left">
                                        <div class="box-1">
                                            <?php if( $car_booking_product_vehicle_power_heading_4 ){ ?>
                                                <h6 class="heading1"><?php echo esc_html( $car_booking_product_vehicle_power_heading_4 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_engine_4 ){ ?>
                                                <h6 class="heading2"><?php echo esc_html( $car_booking_product_vehicle_engine_4 ); ?></h6>
                                            <?php } ?>
                                        </div>
                                        <div class="box-2">
                                            <div class="fuel-btn">
                                                <?php if( $car_booking_product_vehicle_fuel_heading_1_box_4){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_1_box_4 ); ?></span>
                                                <?php } ?>
                                                <?php if( $car_booking_product_vehicle_fuel_heading_2_box_4 ){ ?>
                                                    <span><?php echo esc_html( $car_booking_product_vehicle_fuel_heading_2_box_4 ); ?></span>
                                                <?php } ?>
                                            </div>
                                            <?php if( $car_booking_product_vehicle_speed_4 ){ ?>
                                                <h6><?php echo esc_html( $car_booking_product_vehicle_speed_4 ); ?></h6>
                                            <?php } ?>
                                            <?php if( $car_booking_product_vehicle_speed_text_4 ){ ?>
                                                <p><?php echo esc_html( $car_booking_product_vehicle_speed_text_4 ); ?></p>
                                            <?php } ?>
                                        </div>
                                    </div>
                                    <div class="product-right">
                                        <div class="product-image-box">
                                            <?php if( $car_booking_product_image_4 ){ ?>
                                               <img src="<?php echo esc_url( $car_booking_product_image_4 ); ?>"> 
                                            <?php } ?>
                                            
                                        </div>
                                    </div>
                                </div>
                                <?php if( $car_booking_product_vehicle_discription_4 ){ ?>
                                    <p class="product-text"><?php echo esc_html( $car_booking_product_vehicle_discription_4 ); ?></p>
                                <?php } ?>
                                <?php if( $car_booking_product_button_text_4 ){ ?>
                                    <a class="product-button" href="<?php echo esc_url( $car_booking_product_button_link_4 ); ?>"><?php echo esc_html( $car_booking_product_button_text_4 ); ?><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 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></a>
                                <?php } ?>
                                <?php if( $car_booking_product_vehicle_price_4 ){ ?>
                                    <span class="price-box"><?php echo esc_html( $car_booking_product_vehicle_price_4 ); ?></span>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                    <div class="tab right-tab">
                        <div class="tab-content">
                            <button class="tablinks" onclick="car_booking_product_tab_section(event, 'product3')">
                                <?php if( $car_booking_product_image_3 ){ ?>
                                   <img src="<?php echo esc_url( $car_booking_product_image_3 ); ?>"> 
                                <?php } ?>
                            </button>
                            <?php if( $car_booking_product_vehicle_heading_3 ){ ?>
                                <h3><?php echo esc_html( $car_booking_product_vehicle_heading_3 ); ?></h3>
                            <?php } ?>
                        </div>
                        <div class="tab-content">
                            <button class="tablinks" onclick="car_booking_product_tab_section(event, 'product4')">
                                <?php if( $car_booking_product_image_4 ){ ?>
                                   <img src="<?php echo esc_url( $car_booking_product_image_4 ); ?>"> 
                                <?php } ?>
                            </button>
                            <?php if( $car_booking_product_vehicle_heading_4 ){ ?>
                                <h3><?php echo esc_html( $car_booking_product_vehicle_heading_4 ); ?></h3>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php } ?>
            
    <?php }


endif;

if( !function_exists( 'car_booking_sanitize_menu_transform' ) ) :

    // Sidebar Option Sanitize.
    function car_booking_sanitize_menu_transform( $car_booking_input ){

        $car_booking_metabox_options = array( 'capitalize','uppercase','lowercase');
        if( in_array( $car_booking_input,$car_booking_metabox_options ) ){

            return $car_booking_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'car_booking_sanitize_page_content_alignment' ) ) :

    // Sidebar Option Sanitize.
    function car_booking_sanitize_page_content_alignment( $car_booking_input ){

        $car_booking_metabox_options = array( 'left','center','right');
        if( in_array( $car_booking_input,$car_booking_metabox_options ) ){

            return $car_booking_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'car_booking_sanitize_footer_widget_title_alignment' ) ) :

    // Footer Option Sanitize.
    function car_booking_sanitize_footer_widget_title_alignment( $car_booking_input ){

        $car_booking_metabox_options = array( 'left','center','right');
        if( in_array( $car_booking_input,$car_booking_metabox_options ) ){

            return $car_booking_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'car_booking_sanitize_pagination_type' ) ) :

    /**
     * Sanitize the pagination type setting.
     *
     * @param string $car_booking_input The input value from the Customizer.
     * @return string The sanitized value.
     */
    function car_booking_sanitize_pagination_type( $car_booking_input ) {
        // Define valid options for the pagination type.
        $car_booking_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( $car_booking_input, $car_booking_valid_options, true ) ) {
            return $car_booking_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('car_booking_sanitize_enable_pagination') ) :
    function car_booking_sanitize_enable_pagination( $car_booking_input ) {
        return (bool) $car_booking_input;
    }
endif;

if( !function_exists( 'car_booking_sanitize_copyright_alignment_meta' ) ) :

    // Sidebar Option Sanitize.
    function car_booking_sanitize_copyright_alignment_meta( $car_booking_input ){

        $car_booking_metabox_options = array( 'Default','Reverse','Center');
        if( in_array( $car_booking_input,$car_booking_metabox_options ) ){

            return $car_booking_input;

        }else{

            return '';

        }
    }

endif;

/**
 * Sidebar Layout Function
 */
function car_booking_get_final_sidebar_layout() {
	$car_booking_defaults       = car_booking_get_default_theme_options();
	$car_booking_global_layout  = get_theme_mod('car_booking_global_sidebar_layout', $car_booking_defaults['car_booking_global_sidebar_layout']);
	$car_booking_page_layout    = get_theme_mod('car_booking_page_sidebar_layout', $car_booking_global_layout);
	$car_booking_post_layout    = get_theme_mod('car_booking_post_sidebar_layout', $car_booking_global_layout);
	$car_booking_meta_layout    = get_post_meta(get_the_ID(), 'car_booking_post_sidebar_option', true);

	if (!empty($car_booking_meta_layout) && $car_booking_meta_layout !== 'default') {
		return $car_booking_meta_layout;
	}
	if (is_page() || (function_exists('is_shop') && is_shop())) {
		return $car_booking_page_layout;
	}
	if (is_single()) {
		return $car_booking_post_layout;
	}
	return $car_booking_global_layout;
}