<?php
/**
 * Custom Functions.
 *
 * @package Omega Digital Store
 */

if( !function_exists( 'omega_digital_store_fonts_url' ) ) :

    //Google Fonts URL
    function omega_digital_store_fonts_url(){

        $omega_digital_store_font_families = array(
            'Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900',
        );

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

        return esc_url_raw($omega_digital_store_fonts_url);

    }

endif;

if ( ! function_exists( 'omega_digital_store_sub_menu_toggle_button' ) ) :

    function omega_digital_store_sub_menu_toggle_button( $omega_digital_store_args, $omega_digital_store_item, $depth ) {

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

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

                $omega_digital_store_toggle_target_string = '.menu-item.menu-item-' . $omega_digital_store_item->ID . ' > .sub-menu';

                // Add the sub menu toggle
                $omega_digital_store_args->after .= '<button type="button" class="theme-aria-button submenu-toggle" data-toggle-target="' . $omega_digital_store_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', 'omega-digital-store' ) . '</span>' . omega_digital_store_get_theme_svg( 'chevron-down' ) . '</span></button>';

            }

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

        }elseif( $omega_digital_store_args->theme_location == 'omega-digital-store-primary-menu' ) {

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

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

            } else {

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

            }

        }

        return $omega_digital_store_args;

    }

endif;

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

if ( ! function_exists( 'omega_digital_store_the_theme_svg' ) ):
    
    function omega_digital_store_the_theme_svg( $omega_digital_store_svg_name, $omega_digital_store_return = false ) {

        if( $omega_digital_store_return ){

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

        }else{

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

        }
    }

endif;

if ( ! function_exists( 'omega_digital_store_get_theme_svg' ) ):

    function omega_digital_store_get_theme_svg( $omega_digital_store_svg_name ) {

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

    }

endif;

if( !function_exists( 'omega_digital_store_post_category_list' ) ) :

    // Post Category List.
    function omega_digital_store_post_category_list( $omega_digital_store_select_cat = true ){

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

        $omega_digital_store_post_cat_cat_array = array();
        if( $omega_digital_store_select_cat ){

            $omega_digital_store_post_cat_cat_array[''] = esc_html__( '-- Select Category --','omega-digital-store' );

        }

        foreach ( $omega_digital_store_post_cat_lists as $omega_digital_store_post_cat_list ) {

            $omega_digital_store_post_cat_cat_array[$omega_digital_store_post_cat_list->slug] = $omega_digital_store_post_cat_list->name;

        }

        return $omega_digital_store_post_cat_cat_array;
    }

endif;

if( !function_exists('omega_digital_store_single_post_navigation') ):

    function omega_digital_store_single_post_navigation(){

        $omega_digital_store_default = omega_digital_store_get_default_theme_options();
        $omega_digital_store_twp_navigation_type = esc_attr( get_post_meta( get_the_ID(), 'twp_disable_ajax_load_next_post', true ) );
        $omega_digital_store_current_id = '';
        $article_wrap_class = '';
        global $post;
        $omega_digital_store_current_id = $post->ID;
        if( $omega_digital_store_twp_navigation_type == '' || $omega_digital_store_twp_navigation_type == 'global-layout' ){
            $omega_digital_store_twp_navigation_type = get_theme_mod('twp_navigation_type', $omega_digital_store_default['twp_navigation_type']);
        }

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

            if( $omega_digital_store_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">' . omega_digital_store_the_theme_svg('arrow-left',$omega_digital_store_return = true ) . '</span><span class="screen-reader-text">' . esc_html__('Previous post:', 'omega-digital-store') . '</span><span class="post-title">%title</span>',
                        'next_text' => '<span class="arrow" aria-hidden="true">' . omega_digital_store_the_theme_svg('arrow-right',$omega_digital_store_return = true ) . '</span><span class="screen-reader-text">' . esc_html__('Next post:', 'omega-digital-store') . '</span><span class="post-title">%title</span>',
                    )); ?>
                </div>
                <?php

            }else{

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

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

                }
            }

        }

    }

endif;

add_action( 'omega_digital_store_navigation_action','omega_digital_store_single_post_navigation',30 );

if( !function_exists('omega_digital_store_content_offcanvas') ):

    // Offcanvas Contents
    function omega_digital_store_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', 'omega-digital-store'); ?>
                            </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', 'omega-digital-store'); ?>" role="navigation">
                        <ul class="primary-menu theme-menu">
                            <?php
                            if (has_nav_menu('omega-digital-store-primary-menu')) {
                                wp_nav_menu(
                                    array(
                                        'container' => '',
                                        'items_wrap' => '%3$s',
                                        'theme_location' => 'omega-digital-store-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 Omega_Digital_Store_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( 'omega_digital_store_before_footer_content_action','omega_digital_store_content_offcanvas',30 );

if( !function_exists('omega_digital_store_footer_content_widget') ):

    function omega_digital_store_footer_content_widget(){
        
        $omega_digital_store_default = omega_digital_store_get_default_theme_options();
        
        $omega_digital_store_footer_column_layout = absint(get_theme_mod('omega_digital_store_footer_column_layout', $omega_digital_store_default['omega_digital_store_footer_column_layout']));
        $omega_digital_store_footer_sidebar_class = 12;
        
        if($omega_digital_store_footer_column_layout == 2) {
            $omega_digital_store_footer_sidebar_class = 6;
        }
        
        if($omega_digital_store_footer_column_layout == 3) {
            $omega_digital_store_footer_sidebar_class = 4;
        }
        ?>
        
        <?php if ( get_theme_mod('omega_digital_store_display_footer', true) == true ) : ?>
            <div class="footer-widgetarea">
                <div class="wrapper">
                    <div class="column-row">
                    
                        <?php for ($i = 0; $i < $omega_digital_store_footer_column_layout; $i++) : ?>
                            
                            <div class="column <?php echo 'column-' . absint($omega_digital_store_footer_sidebar_class); ?> column-sm-12">
                                
                                <?php 
                                // If no widgets are assigned, display default widgets
                                if ( ! is_active_sidebar( 'omega-digital-store-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'); ?>" 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 Omega Digital Store WordPress Theme is a versatile, feature-rich solution for creating a dynamic online store. Designed for e-commerce businesses, this theme provides a storefront that can be customized to sell a wide range of products, from electronics and beauty items to clothing and groceries.', 'omega-digital-store'); ?>
                                                </p>
                                            </div>
                                        </div>

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

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

    <?php
    }

endif;

add_action( 'omega_digital_store_footer_content_action', 'omega_digital_store_footer_content_widget', 10 );

if( !function_exists('omega_digital_store_footer_content_info') ):

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

        $omega_digital_store_default = omega_digital_store_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
                                $omega_digital_store_footer_copyright_text = wp_kses_post( get_theme_mod( 'omega_digital_store_footer_copyright_text', $omega_digital_store_default['omega_digital_store_footer_copyright_text'] ) );
                                    echo esc_html( $omega_digital_store_footer_copyright_text );
                                    echo '<br>';
                                    echo esc_html__('Theme: ', 'omega-digital-store') . '<a href="' . esc_url('https://www.omegathemes.com/products/free-online-store-wordpress-theme') . '" title="' . esc_attr__('Wind Energy', 'omega-digital-store') . '" target="_blank"><span>' . esc_html__('Omega Digital Store ', 'omega-digital-store') . '</span></a>' . esc_html__(' By ', 'omega-digital-store') . '  <span>' . esc_html__('OMEGA ', 'omega-digital-store') . '</span>';
                                    echo esc_html__('Powered by ', 'omega-digital-store') . '<a href="' . esc_url('https://wordpress.org') . '" title="' . esc_attr__('WordPress', 'omega-digital-store') . '" target="_blank"><span>' . esc_html__('WordPress.', 'omega-digital-store') . '</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('omega_digital_store_enable_to_the_top', true) == true ) : ?>
                                    <?php
                                    $omega_digital_store_to_the_top_text = get_theme_mod( 'omega_digital_store_to_the_top_text', __( 'To the Top', 'omega-digital-store' ) );
                                    printf( 
                                        wp_kses( 
                                            /* translators: %s is the arrow icon markup */
                                            '%s %s', 
                                            array( 'span' => array( 'class' => array(), 'aria-hidden' => array() ) ) 
                                        ), 
                                        esc_html( $omega_digital_store_to_the_top_text ),
                                        '<span class="arrow" aria-hidden="true">&uarr;</span>' 
                                    );
                                    ?>
                                <?php endif; ?>
                            </span>
                        </a>

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

    <?php
    }

endif;

add_action( 'omega_digital_store_footer_content_action','omega_digital_store_footer_content_info',20 );


if( !function_exists( 'omega_digital_store_main_slider' ) ) :

    function omega_digital_store_main_slider(){

        $omega_digital_store_defaults = omega_digital_store_get_default_theme_options();

        $omega_digital_store_homepage_section_shipping_title = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_shipping_title',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_shipping_title'] ) );

        $omega_digital_store_homepage_section_shipping_text = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_shipping_text',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_shipping_text'] ) );

        $omega_digital_store_homepage_section_exchange_title = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_exchange_title',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_exchange_title'] ) );

        $omega_digital_store_homepage_section_exchange_text = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_exchange_text',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_exchange_text'] ) );

        $omega_digital_store_homepage_section_support_title = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_support_title',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_support_title'] ) );

        $omega_digital_store_homepage_section_support_text = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_support_text',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_support_text'] ) );

        $omega_digital_store_homepage_section_shopping_title = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_shopping_title',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_shopping_title'] ) );

        $omega_digital_store_homepage_section_shopping_text = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_shopping_text',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_shopping_text'] ) );

        $omega_digital_store_slider_image_box_1 = esc_url( get_theme_mod( 'omega_digital_store_slider_image_box_1',
        $omega_digital_store_defaults['omega_digital_store_slider_image_box_1'] ) );

        $omega_digital_store_homepage_section_slider_right_box_1_heading = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_slider_right_box_1_heading',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_slider_right_box_1_heading'] ) );

        $omega_digital_store_homepage_section_slider_aditional_title = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_slider_aditional_title',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_slider_aditional_title'] ) );

        $omega_digital_store_homepage_section_slider_right_box_1_button = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_slider_right_box_1_button',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_slider_right_box_1_button'] ) );

        $omega_digital_store_homepage_section_slider_right_box_1_button_url = esc_url( get_theme_mod( 'omega_digital_store_homepage_section_slider_right_box_1_button_url',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_slider_right_box_1_button_url'] ) );

        $omega_digital_store_defaults = omega_digital_store_get_default_theme_options();
        $omega_digital_store_header_banner = get_theme_mod( 'omega_digital_store_header_banner', $omega_digital_store_defaults['omega_digital_store_header_banner'] );
        $omega_digital_store_header_banner_cat = get_theme_mod( 'omega_digital_store_header_banner_cat' );

        $omega_digital_store_slider_image_box_2 = esc_url( get_theme_mod( 'omega_digital_store_slider_image_box_2',
        $omega_digital_store_defaults['omega_digital_store_slider_image_box_2'] ) );

        $omega_digital_store_homepage_section_slider_right_box_2_heading = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_slider_right_box_2_heading',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_slider_right_box_2_heading'] ) );

        $omega_digital_store_homepage_section_slider_right_box_2_button = esc_html( get_theme_mod( 'omega_digital_store_homepage_section_slider_right_box_2_button',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_slider_right_box_2_button'] ) );

        $omega_digital_store_homepage_section_slider_right_box_2_button_url = esc_url( get_theme_mod( 'omega_digital_store_homepage_section_slider_right_box_2_button_url',
        $omega_digital_store_defaults['omega_digital_store_homepage_section_slider_right_box_2_button_url'] ) );

        $omega_digital_store_defaults = omega_digital_store_get_default_theme_options();
        $omega_digital_store_header_banner = get_theme_mod( 'omega_digital_store_header_banner', $omega_digital_store_defaults['omega_digital_store_header_banner'] );
        $omega_digital_store_header_banner_cat = get_theme_mod( 'omega_digital_store_header_banner_cat' );

        if( $omega_digital_store_header_banner ){

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

          $banner_query = new WP_Query( array('post_type' => 'post', 'posts_per_page' => 4,'post__not_in' => get_option("sticky_posts"), 'category_name' => esc_html( $omega_digital_store_header_banner_cat ) ) );

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

            <div class="theme-custom-block theme-banner-block">
                <div class="wrapper">
                    <div class="slider-main-box">
                        <div class="slider-left-box">
                            <div class="swiper-container theme-main-carousel swiper-container" <?php echo $omega_digital_store_rtl; ?>>
                                <div class="swiper-wrapper">
                                    <?php
                                    while( $banner_query->have_posts() ):
                                        $banner_query->the_post();
                                        $omega_digital_store_featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
                                                $omega_digital_store_default_image = get_template_directory_uri() . '/inc/homepage-setup/assets/homepage-setup-images/slider-img1.png';
                                                $omega_digital_store_featured_image = isset( $omega_digital_store_featured_image[0] ) ? $omega_digital_store_featured_image[0] : $omega_digital_store_default_image;?>

                                        <div class="swiper-slide main-carousel-item">                                 
                                            <div class="theme-article-post">
                                                <div class="entry-thumbnail">
                                                    <div class="data-bg data-bg-large" data-background="<?php echo esc_url($omega_digital_store_featured_image); ?>">
                                                        <a href="<?php the_permalink(); ?>" class="theme-image-responsive" tabindex="0"></a>
                                                    </div>
                                                    <?php omega_digital_store_post_format_icon(); ?>
                                                </div>                                
                                                <div class="main-carousel-caption">
                                                    <div class="post-content">
                                                        <?php if( $omega_digital_store_homepage_section_slider_aditional_title ){ ?>
                                                            <h3><?php echo esc_html( $omega_digital_store_homepage_section_slider_aditional_title ); ?></h3>
                                                        <?php } ?>
                                                        <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>

                                                        <a href="<?php the_permalink(); ?>" class="btn-fancy btn-fancy-primary" tabindex="0">
                                                          <?php echo esc_html__('Shop Now', 'omega-digital-store'); ?>
                                                        </a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endwhile; ?>
                                </div>
                                <div class="swiper-pagination"></div>
                            </div>
                        </div>
                        <div class="slider-right-box">
                            <div class="custom-image-box">
                                 <?php if( $omega_digital_store_slider_image_box_1 ){ ?>
                                    <div class="sale-image">
                                        <img src="<?php echo esc_url( $omega_digital_store_slider_image_box_1 ); ?>">
                                    </div>
                                    <div class="custom-content-box">
                                        <?php if( $omega_digital_store_homepage_section_slider_right_box_1_heading ){ ?>
                                            <h5><?php echo esc_html( $omega_digital_store_homepage_section_slider_right_box_1_heading ); ?></h5>
                                        <?php } ?>
                                        <?php if( $omega_digital_store_homepage_section_slider_right_box_1_button || $omega_digital_store_homepage_section_slider_right_box_1_button_url ){ ?>
                                            <a href="<?php echo esc_url( $omega_digital_store_homepage_section_slider_right_box_1_button_url ); ?>" class="btn-fancy btn-fancy-primary" tabindex="0">
                                              <?php echo esc_html( $omega_digital_store_homepage_section_slider_right_box_1_button ); ?>
                                            </a>
                                        <?php } ?>
                                    </div>
                                <?php } ?>
                            </div>
                            <div class="custom-image-box">
                                 <?php if( $omega_digital_store_slider_image_box_2 ){ ?>
                                    <div class="sale-image">
                                        <img src="<?php echo esc_url( $omega_digital_store_slider_image_box_2 ); ?>">
                                    </div>
                                    <div class="custom-content-box">
                                        <?php if( $omega_digital_store_homepage_section_slider_right_box_2_heading ){ ?>
                                            <h5><?php echo esc_html( $omega_digital_store_homepage_section_slider_right_box_2_heading ); ?></h5>
                                        <?php } ?>
                                        <?php if( $omega_digital_store_homepage_section_slider_right_box_2_button || $omega_digital_store_homepage_section_slider_right_box_2_button_url ){ ?>
                                            <a href="<?php echo esc_url( $omega_digital_store_homepage_section_slider_right_box_2_button_url ); ?>" class="btn-fancy btn-fancy-primary" tabindex="0">
                                              <?php echo esc_html( $omega_digital_store_homepage_section_slider_right_box_2_button ); ?>
                                            </a>
                                        <?php } ?>
                                    </div>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                    

                    <section id="info-header">
                        <div class="header-wrapper">
                            <div class="theme-header-areas header-areas-left">
                                <svg xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M624 352h-16V243.9c0-12.7-5.1-24.9-14.1-33.9L494 110.1c-9-9-21.2-14.1-33.9-14.1H416V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h16c0 53 43 96 96 96s96-43 96-96h128c0 53 43 96 96 96s96-43 96-96h48c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zM160 464c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm320 0c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm80-208H416V144h44.1l99.9 99.9V256z"/></svg>
                                <div class="header-areas-box">
                                    <?php if( $omega_digital_store_homepage_section_shipping_title ){ ?>
                                        <h6><?php echo esc_html( $omega_digital_store_homepage_section_shipping_title ); ?></h6>
                                    <?php } ?>
                                    <?php if( $omega_digital_store_homepage_section_shipping_text ){ ?>
                                        <p><?php echo esc_html( $omega_digital_store_homepage_section_shipping_text ); ?></p>
                                    <?php } ?>
                                </div>
                            </div>
                            <div class="theme-header-areas header-areas-left">
                                <svg xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M212.3 224.3H12c-6.6 0-12-5.4-12-12V12C0 5.4 5.4 0 12 0h48c6.6 0 12 5.4 12 12v78.1C117.8 39.3 184.3 7.5 258.2 8c136.9 1 246.4 111.6 246.2 248.5C504 393.3 393.1 504 256.3 504c-64.1 0-122.5-24.3-166.5-64.2-5.1-4.6-5.3-12.6-.5-17.4l34-34c4.5-4.5 11.7-4.7 16.4-.5C170.8 415.3 211.6 432 256.3 432c97.3 0 176-78.7 176-176 0-97.3-78.7-176-176-176-58.5 0-110.3 28.5-142.3 72.3h98.3c6.6 0 12 5.4 12 12v48c0 6.6-5.4 12-12 12z"/></svg>
                                <div class="header-areas-box">
                                    <?php if( $omega_digital_store_homepage_section_exchange_title ){ ?>
                                        <h6><?php echo esc_html( $omega_digital_store_homepage_section_exchange_title ); ?></h6>
                                    <?php } ?>
                                    <?php if( $omega_digital_store_homepage_section_exchange_text ){ ?>
                                        <p><?php echo esc_html( $omega_digital_store_homepage_section_exchange_text ); ?></p>
                                    <?php } ?>
                                </div>
                            </div>
                            <div class="theme-header-areas header-areas-right">
                                <svg xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M352 160v-32C352 57.4 294.6 0 224 0 153.4 0 96 57.4 96 128v32H0v272c0 44.2 35.8 80 80 80h288c44.2 0 80-35.8 80-80V160h-96zm-192-32c0-35.3 28.7-64 64-64s64 28.7 64 64v32H160v-32zm160 120c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm-192 0c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24z"/></svg>
                                <div class="header-areas-box">
                                    <?php if( $omega_digital_store_homepage_section_support_title ){ ?>
                                        <h6><?php echo esc_html( $omega_digital_store_homepage_section_support_title ); ?></h6>
                                    <?php } ?>
                                    <?php if( $omega_digital_store_homepage_section_support_text ){ ?>
                                        <p><?php echo esc_html( $omega_digital_store_homepage_section_support_text ); ?></p>
                                    <?php } ?>
                                </div>
                            </div>
                            <div class="theme-header-areas header-areas-right">
                                <svg xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M192 208c0-17.7-14.3-32-32-32h-16c-35.4 0-64 28.7-64 64v48c0 35.4 28.7 64 64 64h16c17.7 0 32-14.3 32-32V208zm176 144c35.4 0 64-28.7 64-64v-48c0-35.4-28.7-64-64-64h-16c-17.7 0-32 14.3-32 32v112c0 17.7 14.3 32 32 32h16zM256 0C113.2 0 4.6 118.8 0 256v16c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16v-16c0-114.7 93.3-208 208-208s208 93.3 208 208h-.1c.1 2.4 .1 165.7 .1 165.7 0 23.4-18.9 42.3-42.3 42.3H320c0-26.5-21.5-48-48-48h-32c-26.5 0-48 21.5-48 48s21.5 48 48 48h181.7c49.9 0 90.3-40.4 90.3-90.3V256C507.4 118.8 398.8 0 256 0z"/></svg>
                                <div class="header-areas-box">
                                    <?php if( $omega_digital_store_homepage_section_shopping_title ){ ?>
                                        <h6><?php echo esc_html( $omega_digital_store_homepage_section_shopping_title ); ?></h6>
                                    <?php } ?>
                                    <?php if( $omega_digital_store_homepage_section_shopping_text ){ ?>
                                        <p><?php echo esc_html( $omega_digital_store_homepage_section_shopping_text ); ?></p>
                                    <?php } ?>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>

          <?php
          wp_reset_postdata();
          endif;

        }

    }

endif;

if (!function_exists('omega_digital_store_post_format_icon')):

    // Post Format Icon.
    function omega_digital_store_post_format_icon() {

        $omega_digital_store_format = get_post_format(get_the_ID()) ?: 'standard';
        $omega_digital_store_icon = '';
        $omega_digital_store_title = '';
        if( $omega_digital_store_format == 'video' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'video' );
            $omega_digital_store_title = esc_html__('Video','omega-digital-store');
        }elseif( $omega_digital_store_format == 'audio' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'audio' );
            $omega_digital_store_title = esc_html__('Audio','omega-digital-store');
        }elseif( $omega_digital_store_format == 'gallery' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'gallery' );
            $omega_digital_store_title = esc_html__('Gallery','omega-digital-store');
        }elseif( $omega_digital_store_format == 'quote' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'quote' );
            $omega_digital_store_title = esc_html__('Quote','omega-digital-store');
        }elseif( $omega_digital_store_format == 'image' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'image' );
            $omega_digital_store_title = esc_html__('Image','omega-digital-store');
        } elseif( $omega_digital_store_format == 'link' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'link' );
            $omega_digital_store_title = esc_html__('Link','omega-digital-store');
        } elseif( $omega_digital_store_format == 'status' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'status' );
            $omega_digital_store_title = esc_html__('Status','omega-digital-store');
        } elseif( $omega_digital_store_format == 'aside' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'aside' );
            $omega_digital_store_title = esc_html__('Aside','omega-digital-store');
        } elseif( $omega_digital_store_format == 'chat' ){
            $omega_digital_store_icon = omega_digital_store_get_theme_svg( 'chat' );
            $omega_digital_store_title = esc_html__('Chat','omega-digital-store');
        }
        
        if (!empty($omega_digital_store_icon)) { ?>
            <div class="theme-post-format">
                <span class="post-format-icom"><?php echo omega_digital_store_svg_escape($omega_digital_store_icon); ?></span>
                <?php if( $omega_digital_store_title ){ echo '<span class="post-format-label">'.esc_html( $omega_digital_store_title ).'</span>'; } ?>
            </div>
        <?php }
    }

endif;

if ( ! function_exists( 'omega_digital_store_svg_escape' ) ):

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

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

        return $omega_digital_store_svg;

    }

endif;

if( !function_exists( 'omega_digital_store_sanitize_sidebar_option_meta' ) ) :

    // Sidebar Option Sanitize.
    function omega_digital_store_sanitize_sidebar_option_meta( $omega_digital_store_input ){

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

            return $omega_digital_store_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'omega_digital_store_product_section' ) ) :

    function omega_digital_store_product_section(){
        $omega_digital_store_defaults = omega_digital_store_get_default_theme_options();

        $omega_digital_store_product_section = get_theme_mod( 'omega_digital_store_product_section', $omega_digital_store_defaults['omega_digital_store_product_section'] );

        $omega_digital_store_product_heading = get_theme_mod( 'omega_digital_store_product_heading', $omega_digital_store_defaults['omega_digital_store_product_heading'] );

        $omega_digital_store_product_button_text = get_theme_mod( 'omega_digital_store_product_button_text', $omega_digital_store_defaults['omega_digital_store_product_button_text'] );

        $omega_digital_store_product_button_link = get_theme_mod( 'omega_digital_store_product_button_link', $omega_digital_store_defaults['omega_digital_store_product_button_link'] );

        $omega_digital_store_product_tab_1_heading = get_theme_mod( 'omega_digital_store_product_tab_1_heading', $omega_digital_store_defaults['omega_digital_store_product_tab_1_heading'] );

        $omega_digital_store_product_tab_2_heading = get_theme_mod( 'omega_digital_store_product_tab_2_heading', $omega_digital_store_defaults['omega_digital_store_product_tab_2_heading'] );

        $omega_digital_store_product_tab_3_heading = get_theme_mod( 'omega_digital_store_product_tab_3_heading', $omega_digital_store_defaults['omega_digital_store_product_tab_3_heading'] );

        $omega_digital_store_product_tab_4_heading = get_theme_mod( 'omega_digital_store_product_tab_4_heading', $omega_digital_store_defaults['omega_digital_store_product_tab_4_heading'] );

        if( $omega_digital_store_product_section ){ ?>
            
            <div class="wrapper">
                <div class="main-tab">
                    <div class="tab">
                        <button class="tablinks" onclick="omega_digital_store_product_tab_section(event, 'Rated')">
                            <?php if( $omega_digital_store_product_tab_1_heading ){ ?>
                                <?php echo esc_html( $omega_digital_store_product_tab_1_heading ); ?>
                            <?php } ?>
                        </button>
                        <button class="tablinks" onclick="omega_digital_store_product_tab_section(event, 'Selling')">
                            <?php if( $omega_digital_store_product_tab_2_heading ){ ?>
                                <?php echo esc_html( $omega_digital_store_product_tab_2_heading ); ?>
                            <?php } ?>
                        </button>
                        <button class="tablinks" onclick="omega_digital_store_product_tab_section(event, 'Viewed')">
                            <?php if( $omega_digital_store_product_tab_3_heading ){ ?>
                                <?php echo esc_html( $omega_digital_store_product_tab_3_heading ); ?>
                            <?php } ?>
                        </button>
                        <button class="tablinks" onclick="omega_digital_store_product_tab_section(event, 'Search')">
                            <?php if( $omega_digital_store_product_tab_4_heading ){ ?>
                                <?php echo esc_html( $omega_digital_store_product_tab_4_heading ); ?>
                            <?php } ?>
                        </button>
                    </div>
                    <div class="tab-area">
                        <div class="heading-box">
                            <div class="header-wrapper">
                                <div class="theme-header-areas header-areas-left">
                                    <?php if( $omega_digital_store_product_heading ){ ?>
                                        <h3><?php echo esc_html( $omega_digital_store_product_heading ); ?></h3>
                                    <?php } ?>
                                </div>
                                <div class="theme-header-areas header-areas-right">
                                    <?php if( $omega_digital_store_product_button_text ){ ?>
                                        <a class="product-button" href="<?php echo esc_url( $omega_digital_store_product_button_link ); ?>"><?php echo esc_html( $omega_digital_store_product_button_text ); ?></a>
                                    <?php } ?>
                                </div>
                            </div>
                        </div>
                        <div id="Rated" class="tabcontent">
                            <?php $omega_digital_store_top_rated = get_theme_mod('omega_digital_store_featured_product_top_rated','');
                            if ( class_exists( 'WooCommerce' ) ) {
                            $omega_digital_store_args = array(
                                'post_type' => 'product',
                                'posts_per_page' => 100,
                                'product_cat' => $omega_digital_store_top_rated,
                                'order' => 'ASC'
                            ); ?>

                            <div class="theme-product-block">
                                <div class="product-image">
                                    <?php $loop = new WP_Query( $omega_digital_store_args );
                                    while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
                                        <div class="grid-items">
                                            <figure class="product-img-box">
                                                <?php if (has_post_thumbnail( $loop->post->ID )){ echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); } else { echo '<img src="'.esc_url(wc_placeholder_img_src()).'" />';
                                                } ?>
                                                <div class="product-cart">
                                                    <?php if( $product->is_type( 'simple' ) ) { woocommerce_template_loop_add_to_cart(  $loop->post, $product );
                                                    } ?>
                                                </div>
                                            </figure>
                                            <div class="product-rating"><?php if( $product->is_type( 'simple' ) ){ woocommerce_template_loop_rating( $loop->post, $product ); 
                                            } ?></div>
                                            <h5 class="product-text"><a href="<?php echo esc_url(get_permalink( $loop->post->ID )); ?>"><?php the_title(); ?></a></h5>
                                            <h6 class="<?php echo esc_attr( apply_filters( 'woocommerce_product_price_class', 'price' ) ); ?> "><?php echo $product->get_price_html(); ?></h6>
                                            
                                        </div>
                                    <?php endwhile; wp_reset_postdata(); ?>
                                </div>
                            </div>
                            <?php } ?>
                        </div>

                        <div id="Selling" class="tabcontent">
                            <?php $omega_digital_store_most_selling = get_theme_mod('omega_digital_store_featured_product_most_selling','');
                            if ( class_exists( 'WooCommerce' ) ) {
                            $omega_digital_store_args = array(
                                'post_type' => 'product',
                                'posts_per_page' => 100,
                                'product_cat' => $omega_digital_store_most_selling,
                                'order' => 'ASC'
                            ); ?>

                            <div class="theme-product-block">
                                <div class="product-image">
                                    <?php $loop = new WP_Query( $omega_digital_store_args );
                                    while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
                                        <div class="grid-items">
                                            <figure class="product-img-box">
                                                <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.esc_url(wc_placeholder_img_src()).'" />'; ?>
                                                <div class="product-cart">
                                                    <?php if( $product->is_type( 'simple' ) ) { woocommerce_template_loop_add_to_cart(  $loop->post, $product );} ?>
                                                </div>
                                            </figure>
                                            <h5 class="product-text"><a href="<?php echo esc_url(get_permalink( $loop->post->ID )); ?>"><?php the_title(); ?></a></h5>
                                            <h6 class="<?php echo esc_attr( apply_filters( 'woocommerce_product_price_class', 'price' ) ); ?> "><?php echo $product->get_price_html(); ?></h6>
                                            <div class="product-rating"><?php if( $product->is_type( 'simple' ) ){ woocommerce_template_loop_rating( $loop->post, $product ); } ?></div>
                                        </div>
                                    <?php endwhile; wp_reset_postdata(); ?>
                                </div>
                            </div>
                            <?php } ?>
                        </div>

                        <div id="Viewed" class="tabcontent">
                            <?php $omega_digital_store_most_viewed = get_theme_mod('omega_digital_store_featured_product_most_viewed','');
                            if ( class_exists( 'WooCommerce' ) ) {
                            $omega_digital_store_args = array(
                                'post_type' => 'product',
                                'posts_per_page' => 100,
                                'product_cat' => $omega_digital_store_most_viewed,
                                'order' => 'ASC'
                            ); ?>

                            <div class="theme-product-block">
                                <div class="product-image">
                                    <?php $loop = new WP_Query( $omega_digital_store_args );
                                    while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
                                        <div class="grid-items">
                                            <figure class="product-img-box">
                                                <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.esc_url(wc_placeholder_img_src()).'" />'; ?>
                                                <div class="product-cart">
                                                    <?php if( $product->is_type( 'simple' ) ) { woocommerce_template_loop_add_to_cart(  $loop->post, $product );} ?>
                                                </div>
                                            </figure>
                                            <h5 class="product-text"><a href="<?php echo esc_url(get_permalink( $loop->post->ID )); ?>"><?php the_title(); ?></a></h5>
                                            <h6 class="<?php echo esc_attr( apply_filters( 'woocommerce_product_price_class', 'price' ) ); ?> "><?php echo $product->get_price_html(); ?></h6>
                                            <div class="product-rating"><?php if( $product->is_type( 'simple' ) ){ woocommerce_template_loop_rating( $loop->post, $product ); } ?></div>
                                        </div>
                                    <?php endwhile; wp_reset_postdata(); ?>
                                </div>
                            </div>
                            <?php } ?>
                        </div>

                        <div id="Search" class="tabcontent">
                            <?php $omega_digital_store_most_search = get_theme_mod('omega_digital_store_featured_product_most_search','');
                            if ( class_exists( 'WooCommerce' ) ) {
                            $omega_digital_store_args = array(
                                'post_type' => 'product',
                                'posts_per_page' => 100,
                                'product_cat' => $omega_digital_store_most_search,
                                'order' => 'ASC'
                            ); ?>

                            <div class="theme-product-block">
                                <div class="product-image">
                                    <?php $loop = new WP_Query( $omega_digital_store_args );
                                    while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
                                        <div class="grid-items">
                                            <figure class="product-img-box">
                                                <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.esc_url(wc_placeholder_img_src()).'" />'; ?>
                                                <div class="product-cart">
                                                    <?php if( $product->is_type( 'simple' ) ) { woocommerce_template_loop_add_to_cart(  $loop->post, $product );} ?>
                                                </div>
                                            </figure>
                                            <h5 class="product-text"><a href="<?php echo esc_url(get_permalink( $loop->post->ID )); ?>"><?php the_title(); ?></a></h5>
                                            <h6 class="<?php echo esc_attr( apply_filters( 'woocommerce_product_price_class', 'price' ) ); ?> "><?php echo $product->get_price_html(); ?></h6>
                                            <div class="product-rating"><?php if( $product->is_type( 'simple' ) ){ woocommerce_template_loop_rating( $loop->post, $product ); } ?></div>
                                        </div>
                                    <?php endwhile; wp_reset_postdata(); ?>
                                </div>
                            </div>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>

        <?php  }
    }

endif;

if( !function_exists( 'omega_digital_store_sanitize_footer_widget_title_alignment' ) ) :

    // Footer Option Sanitize.
    function omega_digital_store_sanitize_footer_widget_title_alignment( $omega_digital_store_input ){

        $omega_digital_store_metabox_options = array( 'left','center','right');
        if( in_array( $omega_digital_store_input,$omega_digital_store_metabox_options ) ){

            return $omega_digital_store_input;

        }else{

            return '';

        }
    }

endif;

if( !function_exists( 'omega_digital_store_sanitize_footer_widget_title_alignment' ) ) :

    // Footer Option Sanitize.
    function omega_digital_store_sanitize_footer_widget_title_alignment( $omega_digital_store_input ){

        $omega_digital_store_metabox_options = array( 'left','center','right');
        if( in_array( $omega_digital_store_input,$omega_digital_store_metabox_options ) ){

            return $omega_digital_store_input;

        }else{

            return '';

        }
    }

endif;

/**
 * Sidebar Layout Function
 */
function omega_digital_store_get_final_sidebar_layout() {
	$omega_digital_store_defaults       = omega_digital_store_get_default_theme_options();
	$omega_digital_store_global_layout  = get_theme_mod('omega_digital_store_global_sidebar_layout', $omega_digital_store_defaults['omega_digital_store_global_sidebar_layout']);
	$omega_digital_store_page_layout    = get_theme_mod('omega_digital_store_page_sidebar_layout', $omega_digital_store_global_layout);
	$omega_digital_store_post_layout    = get_theme_mod('omega_digital_store_post_sidebar_layout', $omega_digital_store_global_layout);
	$omega_digital_store_meta_layout    = get_post_meta(get_the_ID(), 'omega_digital_store_post_sidebar_option', true);

	if (!empty($omega_digital_store_meta_layout) && $omega_digital_store_meta_layout !== 'default') {
		return $omega_digital_store_meta_layout;
	}
	if (is_page() || (function_exists('is_shop') && is_shop())) {
		return $omega_digital_store_page_layout;
	}
	if (is_single()) {
		return $omega_digital_store_post_layout;
	}
	return $omega_digital_store_global_layout;
}