HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/dreamssalon-wp-market/wp-content/themes/dreamsalon/inc/init.php
<?php
// Get current ID of post/page, etc
if( !function_exists( 'dreamsalon_get_current_id' )):
function dreamsalon_get_current_id(){

    if (get_query_var('user_type') && get_query_var('dashboard_tab')) {
        $dashboard_page_id = get_theme_mod('dashboard_page');
        return $dashboard_page_id ?: get_the_ID();
    }
	
    $current_page_id = '';
    // Get The Page ID You Need
    if(class_exists("woocommerce")) {
        if( is_shop() ){
            $current_page_id  =  get_option ( 'woocommerce_shop_page_id' );
        }elseif(is_cart()) {
            $current_page_id  =  get_option ( 'woocommerce_cart_page_id' );
        }elseif(is_checkout()){
            $current_page_id  =  get_option ( 'woocommerce_checkout_page_id' );
        }elseif(is_account_page()){
            $current_page_id  =  get_option ( 'woocommerce_myaccount_page_id' );
        }elseif(is_view_order_page()){
            $current_page_id  = get_option ( 'woocommerce_view_order_page_id' );
        }
    }
    if($current_page_id=='') {
        if ( is_home () && is_front_page () ) {
            $current_page_id = '';
        } elseif ( is_home () ) {
            $current_page_id = get_option ( 'page_for_posts' );
        } elseif ( is_search () || is_category () || is_tag () || is_tax () || is_archive() ) {
            $current_page_id = '';
        } elseif ( !is_404 () ) {
           $current_page_id = get_the_id();
        } 
    }

    return $current_page_id;
}
endif;
 


if (!function_exists('dreamsalon_pagination_theme')):
function dreamsalon_pagination_theme() {
        if (is_singular())
            return;
    
        global $wp_query;
    
        if ($wp_query->max_num_pages <= 1)
            return;
    
        $paged = get_query_var('paged') ? absint(get_query_var('paged')) : 1;
        $max   = intval($wp_query->max_num_pages);
        $links = [];
    
        if ($paged >= 1)
            $links[] = $paged;
    
        if ($paged >= 3) {
            $links[] = $paged - 1;
            $links[] = $paged - 2;
        }
    
        if (($paged + 2) <= $max) {
            $links[] = $paged + 1;
            $links[] = $paged + 2;
        }
        ?>
        
        <div class="col-md-12 mt-4">
            <nav class="pagination-nav" aria-label="<?php esc_attr_e('Page navigation', 'dreamsalon'); ?>">
                <ul class="pagination justify-content-center mt-md-4">
                    <?php if ($paged > 1): ?>
                        <li class="page-item">
                            <a class="page-link" href="<?php echo get_pagenum_link($paged - 1); ?>" aria-label="<?php esc_attr_e('Previous', 'dreamsalon'); ?>">
                                <span aria-hidden="true"><i class="ti ti-chevron-left"></i></span>
                            </a>
                        </li>
                    <?php else: ?>
                        <li class="page-item disabled">
                            <a class="page-link" href="#" aria-label="<?php esc_attr_e('Previous', 'dreamsalon'); ?>">
                                <span aria-hidden="true"><i class="ti ti-chevron-left"></i></span>
                            </a>
                        </li>
                    <?php endif; ?>

                    <?php
                    // First page
                    if (!in_array(1, $links)) :
                        $class = (1 == $paged) ? ' active' : '';
                        ?>
                        <li class="page-item <<?php echo esc_attr( $class ); ?>">
                            <a class="page-link" href="<?php echo esc_url(get_pagenum_link(1)); ?>">1</a>
                        </li>
                        <?php
                        if (!in_array(2, $links)) :
                            ?>
                            <li class="page-item disabled">
                                <a class="page-link" href="javascript:void(0);">…</a>
                            </li>
                            <?php
                        endif;
                    endif;

                    // Middle pages
                    sort($links);
                    foreach ((array) $links as $link) :
                        $class = ($paged == $link) ? ' active' : '';
                        ?>
                        <li class="page-item<?php echo esc_attr( $class ); ?>">
                            <a class="page-link" href="<?php echo esc_url(get_pagenum_link($link)); ?>"><?php echo wp_kses_post($link); ?></a>
                        </li>
                        <?php
                    endforeach;

                    // Last page
                    if (!in_array($max, $links)) :
                        if (!in_array($max - 1, $links)) :
                            ?>
                            <li class="page-item disabled">
                                <a class="page-link" href="javascript:void(0);">…</a>
                            </li>
                            <?php
                        endif;
                        $class = ($paged == $max) ? ' active' : '';
                        ?>
                        <li class="page-item <?php echo esc_attr( $class ); ?>">
                            <a class="page-link" href="<?php echo esc_url(get_pagenum_link($max)); ?>"><?php echo wp_kses_post($max); ?></a>
                        </li>
                        <?php
                    endif;
                    ?>

                    <?php if ($paged < $max): ?>
                        <li class="page-item">
                            <a class="page-link" href="<?php echo get_pagenum_link($paged + 1); ?>" aria-label="<?php esc_attr_e('Next', 'dreamsalon'); ?>">
                                <span aria-hidden="true"><i class="ti ti-chevron-right"></i></span>
                            </a>
                        </li>
                    <?php else: ?>
                        <li class="page-item disabled">
                            <a class="page-link" href="#" aria-label="<?php esc_attr_e('Next', 'dreamsalon'); ?>">
                                <span aria-hidden="true"><i class="ti ti-chevron-right"></i></span>
                            </a>
                        </li>
                    <?php endif; ?>
                </ul>
            </nav>
        </div>
        <?php
    }
endif;

    
if( !function_exists( 'dreamsalon_pagination_theme_old' )):
function dreamsalon_pagination_theme_old() {
               
    if( is_singular() )
        return;
 
    global $wp_query;
 
    /** Stop execution if there's only 1 page */
    if( $wp_query->max_num_pages <= 1 )
        return;
 
    $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
    $max   = intval( $wp_query->max_num_pages );
 
    /** Add current page to the array */
    if ( $paged >= 1 )
        $links[] = $paged;
 
    /** Add the pages around the current page to the array */
    if ( $paged >= 3 ) {
        $links[] = $paged - 1;
        $links[] = $paged - 2;
    }
 
    if ( ( $paged + 2 ) <= $max ) {
        $links[] = $paged + 2;
        $links[] = $paged + 1;
    }
 
    echo wp_kses( __( '<div class="blog-pagination"><nav><ul class="pagination page-item justify-content-center">','dreamsalon' ), true ) . "\n";
 
    /** Previous Post Link */
    if ( get_previous_posts_link() )
        printf( '<li class="previtem page-numbers">%s</li>' . "\n", get_previous_posts_link('<i class="fas fa-regular fa-arrow-left me-2"></i>'. esc_html__('Prev', 'dreamsalon')) );
 
    /** Link to first page, plus ellipses if necessary */
    if ( ! in_array( 1, $links ) ) {
        $class = 1 == $paged ? ' class="active"' : '';
 
        printf( '<li%s><a class="page-item" href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
 
        if ( ! in_array( 2, $links ) )
            echo wp_kses( __('<li><a class="page-item">&#x2022;&#x2022;&#x2022;</a></li>' ,'dreamsalon') , true);
    }
 
    /** Link to current page, plus 2 pages in either direction if necessary */
    sort( $links );
    foreach ( (array) $links as $link ) {
        $class = $paged == $link ? ' class="active"' : '';
        printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );
    }
 
    /** Link to last page, plus ellipses if necessary */
    if ( ! in_array( $max, $links ) ) {
        if ( ! in_array( $max - 1, $links ) )
            echo wp_kses( __('<li><a class="page-item">&#x2022;&#x2022;&#x2022;</a></li>' ,'dreamsalon') , true) . "\n";
 
        $class = $paged == $max ? ' class="active"' : '';
        printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );
    }
 
    /** Next Post Link */
    if ( get_next_posts_link() )
        printf( '<li class="nextlink page-numbers">%s</li>' . "\n", get_next_posts_link(esc_html__('Next', 'dreamsalon').' <i class="fas fa-regular fa-arrow-right ms-2"></i>') );
 
    echo wp_kses( __( '</ul></nav></div>' ,'dreamsalon'), true ) . "\n";
 
}
endif;


 


/* Setup Theme */
/* Add theme support */
add_action('after_setup_theme', 'dreamsalon_theme_support', 10);
add_filter('oembed_result', 'dreamsalon_framework_fix_oembeb', 10 );
add_filter('paginate_links', 'dreamsalon_fix_pagination_error',10);


function dreamsalon_theme_support(){

    if ( ! isset( $content_width ) ) $content_width = 900;

    add_theme_support('title-tag');

    // Adds RSS feed links to <head> for posts and comments.
    add_theme_support( 'automatic-feed-links' );

    // Switches default core markup for search form, comment form, and comments    
    // to output valid HTML5.
    add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'script', 'style' ) );

    /* See http://codex.wordpress.org/Post_Formats */
   /// add_theme_support( 'post-formats', array( 'image', 'gallery', 'audio', 'video') );

    add_theme_support( 'post-thumbnails' );
    
    add_theme_support( 'custom-header' );
    add_theme_support( 'custom-background');

    add_image_size( 'dreamsalon_list', '350', false );
    add_image_size( 'dreamsalon_m', '600', false );

    add_image_size( 'dreamsalon_bloglist', '855', false );
    add_image_size( 'dreamsalon_bloggrid', '415', false );

    add_theme_support( 'woocommerce' );
    
}



function dreamsalon_framework_fix_oembeb( $url ){
    $array = array (
        'webkitallowfullscreen'     => '',
        'mozallowfullscreen'        => '',
        'frameborder="0"'           => '',
        '</iframe>)'        => '</iframe>'
    );
    $url = strtr( $url, $array );

    if ( strpos( $url, "<embed src=" ) !== false ){
        return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $url);
    }
    elseif ( strpos ( $url, 'feature=oembed' ) !== false ){
        return str_replace( 'feature=oembed', 'feature=oembed&amp;wmode=opaque', $url );
    }
    else{
        return $url;
    }
}


// Fix pagination
function dreamsalon_fix_pagination_error($link) {
    return str_replace('#038;', '&', $link);
}

function dreamsalon_wpadminjs() {
    wp_enqueue_style('dreamsalon_fixcssadmin', get_template_directory_uri() . '/inc/cssadmin.css', false, '1.1');
}

add_action( 'admin_enqueue_scripts', 'dreamsalon_wpadminjs' ); 


add_filter( 'woocommerce_product_description_heading', 'dreamsalon_remove_product_description_heading' );
function dreamsalon_remove_product_description_heading() {
 return '';
}


add_action( 'woocommerce_before_cart', 'dreamsalon_woocommerce_before_cart', 10, 1 ); 
function dreamsalon_woocommerce_before_cart(){
    echo '<div class="dreamsalon_page_cart">';
}

add_action( 'woocommerce_after_cart', 'dreamsalon_woocommerce_after_cart', 10, 1 ); 
function dreamsalon_woocommerce_after_cart(){
    echo '</div>';
}

add_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_delimiter' );
function wcc_change_breadcrumb_delimiter( $defaults ) {
    // Change the breadcrumb delimeter from '/' to '>'
    $defaults['delimiter'] = ' > ';
    return $defaults;
}


add_filter( 'woocommerce_output_related_products_args', 'dreamsalon_related_products_args' );
  function dreamsalon_related_products_args( $args ) {
    $args['posts_per_page'] = 3; // 4 related products
    $args['columns'] = 3; // arranged in 2 columns
    return $args;
}

function dreamsalon_heading_title(){
    ob_start(); 
    
    $user_type = get_query_var('user_type');
    $dashboard_tab = get_query_var('dashboard_tab');
    
    if ($user_type && $dashboard_tab) {
        // Dashboard page titles
        $tabs = [
            'agent' => [
                'overview' => __('Agent Dashboard', 'dreamsalon'),
                'bookings' => __('Bookings', 'dreamsalon'),
                'earnings' => __('Earnings', 'dreamsalon'),
                'reviews' => __('Reviews', 'dreamsalon'),
                'profile' => __('Profile', 'dreamsalon'),
            ],
            'customer' => [
                'overview' => __('Customer Dashboard', 'dreamsalon'),
                'bookings' => __('My Bookings', 'dreamsalon'),
                'wishlist' => __('Wishlist', 'dreamsalon'),
                'reviews' => __('My Reviews', 'dreamsalon'),
                'profile' => __('Profile', 'dreamsalon'),
            ]
        ];
        
        if (isset($tabs[$user_type][$dashboard_tab])) {
            echo esc_html($tabs[$user_type][$dashboard_tab]);
        } else {
            echo esc_html(ucfirst($user_type) . ' ' . __('Dashboard', 'dreamsalon'));
        }
        
    } else if (is_page_template('page-templates/dashboard.php')) {
        // Main dashboard page
        echo esc_html__('Dashboard', 'dreamsalon');
        
    }
    else {
        // Author Service Template: custom heading
        if (is_page_template('author-service.php')) {   
            $author_label = '';
            $author_slug = get_query_var('author_name');
            if (!empty($author_slug)) {
                $u = get_user_by('slug', $author_slug);
                if ($u) { $author_label = $u->display_name; }
            }
            if ($author_label === '' && isset($_GET['author_id'])) {
                $u = get_user_by('id', absint($_GET['author_id']));
                if ($u) { $author_label = $u->display_name; }
            }
            if ($author_label === '' && is_user_logged_in()) {
                $u = wp_get_current_user();
                if ($u && $u->ID) { $author_label = $u->display_name; }
            }
            if ($author_label !== '') {
                echo esc_html(sprintf(__('Author: %s', 'dreamsalon'), $author_label));
                return ob_get_clean();
            }
        }

        // Your existing logic for other pages
    if( class_exists( 'woocommerce' ) && is_woocommerce()  ){  

            if( isset( $_GET['dsrent_search'] ) && $_GET['dsrent_search'] != '' ){

                echo esc_html__( 'Search' ,'dreamsalon');

            }else if ( is_product_category() || is_shop() ){

                if ( apply_filters( 'woocommerce_show_page_title', true ) ) :
                    woocommerce_page_title();
                endif;
                
            }else if( is_product() ){ 
                $product = wc_get_product( get_the_id() );
                if( !$product->is_type( 'dsrent_car_rental' ) ){
                    the_title();
                }
            }else{
                the_title(); 
            }
            }else{

             if( isset( $_GET['dsrent_search'] ) && $_GET['dsrent_search'] != '' ){
                echo esc_html__( 'Search','dreamsalon' );
            } else if ( is_home() ) { 
                echo esc_html__( 'Blog','dreamsalon');
            } else if ( is_search () ) {  
                  echo esc_html__( 'Search','dreamsalon' ); 
            } elseif( is_category() ){  
                     echo single_cat_title();  
            } elseif( is_tag() ){ 
             echo esc_html__( 'Tag','dreamsalon' );
            } elseif( is_tax () || is_archive() ){ 
                if (is_tax('service_category')) { // Replace with your actual taxonomy slug
                    $term = get_queried_object();
                    echo esc_html($term->name);
                } else {
                    the_archive_title();
                }
            } else if( is_single() ){ 
            echo esc_html__( 'Post Detail','dreamsalon' ); 
            } else if( is_single() ){  
            echo esc_html( 'Post Detail','dreamsalon' );
            } else if ( !is_404 () ) { 
                if( get_post_meta(  dreamsalon_get_current_id() ,'dreamsalon_met_page_heading', true ) != 'no' ){  
                    the_title();  
                }  
         }else if( is_404() ){ 
             echo esc_html__( '404 Page','dreamsalon' );
          }  
          }  
        }
          return ob_get_clean();
}

function dreamsalon_breadcrumbs_header(){
    $user_type = get_query_var('user_type');
    $dashboard_tab = get_query_var('dashboard_tab');
    
    if ($user_type && $dashboard_tab) {
        // Display custom breadcrumbs for dashboard
        dreamsalon_dashboard_breadcrumbs($user_type, $dashboard_tab);
    } else {
        // Existing breadcrumb logic for other pages
        if( isset( $_GET['dsrent_search'] ) && $_GET['dsrent_search'] != '' ){

                dreamsalon_breadcrumbs();

        }else if( ! ( class_exists( 'woocommerce' ) && is_woocommerce() ) ){

            if( get_post_meta(  dreamsalon_get_current_id() ,'dreamsalon_met_show_breadcrumbs', true ) != 'no' ){
                dreamsalon_breadcrumbs();
            }

        }else if( is_product() ){

            $product = wc_get_product( get_the_id() );
            if( !$product->is_type( 'dsrent_car_rental' ) ){
                do_action( 'woocommerce_before_main_content' );
            }

        }else{
                do_action( 'woocommerce_before_main_content' );    
            } 
    }
}

// New function for dashboard breadcrumbs
function dreamsalon_dashboard_breadcrumbs($user_type, $current_tab) {
    $dashboard_page_id = get_theme_mod('dashboard_page');
    $dashboard_url = get_permalink($dashboard_page_id);
    $tabs = [
        'agent' => [
            'overview' => __('Overview', 'dreamsalon'),
            'service' => __('My Service', 'dreamsalon'),
            'bookings' => __('Bookings', 'dreamsalon'),
            'earnings' => __('Earnings', 'dreamsalon'),
            'reviews' => __('Reviews', 'dreamsalon'),
            'profile' => __('Profile', 'dreamsalon'),
        ],
        'customer' => [
            'overview' => __('Overview', 'dreamsalon'),
            'bookings' => __('My Bookings', 'dreamsalon'),
            'wishlist' => __('Wishlist', 'dreamsalon'),
            'reviews' => __('My Reviews', 'dreamsalon'),
            'profile' => __('Profile', 'dreamsalon'),
        ]
    ];
    ?>
    <nav class="dreamsalon-dashboard-breadcrumb" aria-label="breadcrumb">
        <ol class="breadcrumb justify-content-center">
            <li class="breadcrumb-item">
                <a href="<?php echo esc_url(home_url('/')); ?>">
                   <i class="isax isax-home5 me-1"></i>
                </a>
            </li>
            <li class="breadcrumb-item">
                <!-- <a href="<?php echo esc_url($dashboard_url); ?>"> -->
                    <?php esc_html_e('Dashboard', 'dreamsalon'); ?>
                <!-- </a> -->
            </li>
            <?php if ($current_tab !== 'overview' && isset($tabs[$user_type][$current_tab])): ?>
                <li class="breadcrumb-item active" aria-current="page">
                    <?php echo esc_html($tabs[$user_type][$current_tab]); ?>
                </li>
            <?php endif; ?>
        </ol>
    </nav>
    <?php
}

/**
 * Rename order item meta keys in WooCommerce emails.
 */
add_filter( 'woocommerce_order_item_display_meta_key', function( $display_key, $meta, $item ) {

    // Rename meta keys (labels)
    $rename = array(
        'ds_service_title' => 'Service',
        'ds_staff_id'      => 'Staff',
        'ds_service_id'    => 'Service ID',
        'ds_date'          => 'Date',
        'ds_slot'          => 'Time Slot',
        'ds_addons'        => 'Addons',
        'ds_addons_price'  => 'Addons Price',
        'ds_base_price'    => 'Base Price',
        'ds_branch_id'     => 'Branch ID',
        'ds_branch_title'  => 'Branch Name',
        'ds_branch_location' => 'Branch Location',
        'booking'          => 'Booking Info',
    );

    if ( isset( $rename[ $meta->key ] ) ) {
        return $rename[ $meta->key ];
    }

    return $display_key;

}, 10, 3 );


add_filter( 'woocommerce_order_item_display_meta_value', function( $display_value, $meta, $item ) {

    // For staff id → show staff NAME
    if ( $meta->key === 'ds_staff_id' ) {
        $staff_id = intval( $meta->value );
        if ( $staff_id > 0 ) {
            $user = get_userdata( $staff_id );
            if ( $user ) {
                return $user->display_name; // Return staff name
            }
        }
        return 'Unknown Staff';
    }

    // For branch ID → show branch name if available
    if ( $meta->key === 'ds_branch_id' ) {
        $branch_id = intval( $meta->value );
        
        // Try to get branch name from the item's meta data
        $branch_name = '';
        foreach ( $item->get_meta_data() as $item_meta ) {
            if ( $item_meta->key === 'ds_branch_title' ) {
                $branch_name = $item_meta->value;
                break;
            }
        }
        
        if ( ! empty( $branch_name ) ) {
            return $branch_name . ' (ID: ' . $branch_id . ')';
        }
        
        return 'Branch ID: ' . $branch_id;
    }

    // For branch title → format nicely
    if ( $meta->key === 'ds_branch_title' ) {
        return ! empty( $meta->value ) ? $meta->value : 'Not specified';
    }

    // For branch location → format with line breaks
    if ( $meta->key === 'ds_branch_location' ) {
        if ( empty( $meta->value ) ) {
            return 'Not specified';
        }
        
        // If location contains commas, add line breaks
        if ( strpos( $meta->value, ',' ) !== false ) {
            return str_replace( ',', ',<br>', $meta->value );
        }
        
        return $meta->value;
    }

    // For addons → format the JSON properly
    if ( $meta->key === 'ds_addons' ) {
        $addons_data = json_decode( $meta->value, true );
        
        if ( json_last_error() === JSON_ERROR_NONE && is_array( $addons_data ) && ! empty( $addons_data ) ) {
            $formatted_addons = array();
            
            foreach ( $addons_data as $addon ) {
                if ( isset( $addon['title'] ) ) {
                    $line = $addon['title'];
                    
                    // Add price if available
                    if ( isset( $addon['price'] ) && $addon['price'] > 0 ) {
                        $line .= ' - $' . number_format( floatval( $addon['price'] ), 2 );
                    }
                    
                    // Add duration if available
                    if ( isset( $addon['dur_h'] ) && isset( $addon['dur_m'] ) ) {
                        $duration_parts = array();
                        
                        if ( intval( $addon['dur_h'] ) > 0 ) {
                            $duration_parts[] = intval( $addon['dur_h'] ) . ' hour' . ( intval( $addon['dur_h'] ) > 1 ? 's' : '' );
                        }
                        
                        if ( intval( $addon['dur_m'] ) > 0 ) {
                            $duration_parts[] = intval( $addon['dur_m'] ) . ' minute' . ( intval( $addon['dur_m'] ) > 1 ? 's' : '' );
                        }
                        
                        if ( ! empty( $duration_parts ) ) {
                            $line .= ' (' . implode( ' ', $duration_parts ) . ')';
                        }
                    }
                    
                    $formatted_addons[] = $line;
                }
            }
            
            if ( ! empty( $formatted_addons ) ) {
                return implode( '<br>', $formatted_addons );
            }
        }
        
        // If no valid addons or empty array
        return 'No addons';
    }


    // For appointment date → format like dashboard (d M, Y)
    if ( $meta->key === 'ds_date' ) {
        if ( empty( $meta->value ) ) {
            return $display_value;
        }

        $timestamp = strtotime( $meta->value );
        if ( ! $timestamp ) {
            return $display_value;
        }

        return esc_html( date_i18n( 'd M, Y', $timestamp ) );
    }

    // For appointment slot/time → format like dashboard using ds_format_slot_range
    if ( $meta->key === 'ds_slot' ) {
        if ( empty( $meta->value ) ) {
            return $display_value;
        }

        $slot_raw = (string) $meta->value;
        $slot_html = function_exists( 'ds_format_slot_range' )
            ? ds_format_slot_range( $slot_raw )
            : $slot_raw;

        // Add space before AM/PM, same as dashboard templates
        $slot_html = preg_replace( '/(\d{1,2}:\d{2})([AP]M)/', '$1 $2', $slot_html );

        return wp_kses_post( $slot_html );
    }


    return $display_value;

}, 10, 3 );

// Render footer menu items from menu IDs (top-level only)
if ( ! function_exists( 'dreamsalon_render_footer_menu_items' ) ) {
    function dreamsalon_render_footer_menu_items( $menu_ids ) {
        if ( empty( $menu_ids ) ) { return; }
        $menu_ids = (array) $menu_ids;
        foreach ( $menu_ids as $menu_id ) {
            $menu = wp_get_nav_menu_object( $menu_id );
            if ( ! $menu ) { continue; }
            $items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
            if ( empty( $items ) ) { continue; }
            foreach ( $items as $item ) {
                if ( ! empty( $item->menu_item_parent ) ) { continue; }
                echo '<li><a href="' . esc_url( $item->url ) . '">' . esc_html( $item->title ) . '</a></li>';
            }
        }
    }
}


// Render footer menu items from menu IDs (top-level only)
if ( ! function_exists( 'dreamsalon_render_footer_menu_items_footer1' ) ) {
    function dreamsalon_render_footer_menu_items_footer1( $menu_ids ) {
        if ( empty( $menu_ids ) ) { return; }
        $menu_ids = (array) $menu_ids;
        foreach ( $menu_ids as $menu_id ) {
            $menu = wp_get_nav_menu_object( $menu_id );
            if ( ! $menu ) { continue; }
            $items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
            if ( empty( $items ) ) { continue; }
            foreach ( $items as $item ) {
                if ( ! empty( $item->menu_item_parent ) ) { continue; }
                echo '<li><a href="' . esc_url( $item->url ) . '"><span class="me-2">&#x25CF;</span>' . esc_html( $item->title ) . '</a></li>';
            }
        }
    }
}

// Render footer menu items from menu IDs (top-level only)
if ( ! function_exists( 'dreamsalon_render_footer_menu_items_footer2' ) ) {
    function dreamsalon_render_footer_menu_items_footer2( $menu_ids ) {
        if ( empty( $menu_ids ) ) { return; }
        $menu_ids = (array) $menu_ids;
        foreach ( $menu_ids as $menu_id ) {
            $menu = wp_get_nav_menu_object( $menu_id );
            if ( ! $menu ) { continue; }
            $items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
            if ( empty( $items ) ) { continue; }
            foreach ( $items as $item ) {
                if ( ! empty( $item->menu_item_parent ) ) { continue; }
                echo '<li><a href="' . esc_url( $item->url ) . '"><i class="fa fa-angle-right me-2"></i>' . esc_html( $item->title ) . '</a></li>';
            }
        }
    }
}