Current File : /home/mdkeenpw/www/wp-content/themes/globallogistics/sidebar.php
<?php
/**
 * The Sidebar containing the main widget areas.
 *
 * @package GLOBALLOGISTICS
 * @since GLOBALLOGISTICS 1.0
 */

if ( globallogistics_sidebar_present() ) {
	
	$globallogistics_sidebar_type = globallogistics_get_theme_option( 'sidebar_type' );
	if ( 'custom' == $globallogistics_sidebar_type && ! globallogistics_is_layouts_available() ) {
		$globallogistics_sidebar_type = 'default';
	}
	
	// Catch output to the buffer
	ob_start();
	if ( 'default' == $globallogistics_sidebar_type ) {
		// Default sidebar with widgets
		$globallogistics_sidebar_name = globallogistics_get_theme_option( 'sidebar_widgets' );
		globallogistics_storage_set( 'current_sidebar', 'sidebar' );
		if ( is_active_sidebar( $globallogistics_sidebar_name ) ) {
			dynamic_sidebar( $globallogistics_sidebar_name );
		}
	} else {
		// Custom sidebar from Layouts Builder
		$globallogistics_sidebar_id = globallogistics_get_custom_sidebar_id();
		do_action( 'globallogistics_action_show_layout', $globallogistics_sidebar_id );
	}
	$globallogistics_out = trim( ob_get_contents() );
	ob_end_clean();
	
	// If any html is present - display it
	if ( ! empty( $globallogistics_out ) ) {
		$globallogistics_sidebar_position    = globallogistics_get_theme_option( 'sidebar_position' );
		$globallogistics_sidebar_position_ss = globallogistics_get_theme_option( 'sidebar_position_ss' );
		?>
		<div class="sidebar widget_area
			<?php
			echo ' ' . esc_attr( $globallogistics_sidebar_position );
			echo ' sidebar_' . esc_attr( $globallogistics_sidebar_position_ss );
			echo ' sidebar_' . esc_attr( $globallogistics_sidebar_type );

			$globallogistics_sidebar_scheme = apply_filters( 'globallogistics_filter_sidebar_scheme', globallogistics_get_theme_option( 'sidebar_scheme' ) );
			if ( ! empty( $globallogistics_sidebar_scheme ) && ! globallogistics_is_inherit( $globallogistics_sidebar_scheme ) && 'custom' != $globallogistics_sidebar_type ) {
				echo ' scheme_' . esc_attr( $globallogistics_sidebar_scheme );
			}
			?>
		" role="complementary">
			<?php

			// Skip link anchor to fast access to the sidebar from keyboard
			?>
			<a id="sidebar_skip_link_anchor" class="globallogistics_skip_link_anchor" href="#"></a>
			<?php

			do_action( 'globallogistics_action_before_sidebar_wrap', 'sidebar' );

			// Button to show/hide sidebar on mobile
			if ( in_array( $globallogistics_sidebar_position_ss, array( 'above', 'float' ) ) ) {
				$globallogistics_title = apply_filters( 'globallogistics_filter_sidebar_control_title', 'float' == $globallogistics_sidebar_position_ss ? esc_html__( 'Show Sidebar', 'globallogistics' ) : '' );
				$globallogistics_text  = apply_filters( 'globallogistics_filter_sidebar_control_text', 'above' == $globallogistics_sidebar_position_ss ? esc_html__( 'Show Sidebar', 'globallogistics' ) : '' );
				?>
				<a href="#" class="sidebar_control" title="<?php echo esc_attr( $globallogistics_title ); ?>"><?php echo esc_html( $globallogistics_text ); ?></a>
				<?php
			}
			?>
			<div class="sidebar_inner">
				<?php
				do_action( 'globallogistics_action_before_sidebar', 'sidebar' );
				globallogistics_show_layout( preg_replace( "/<\/aside>[\r\n\s]*<aside/", '</aside><aside', $globallogistics_out ) );
				do_action( 'globallogistics_action_after_sidebar', 'sidebar' );
				?>
			</div>
			<?php

			do_action( 'globallogistics_action_after_sidebar_wrap', 'sidebar' );

			?>
		</div>
		<div class="clearfix"></div>
		<?php
	}
}