File: /home/defaultwebsite/public/wp-content/themes/webgatha/sidebar-footer.php
<?php
/**
* The sidebar containing the footer widget area.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package WebGatha
* @since 1.0.0
*/
global $webgatha_options, $post;
$footer_above_content = '';
if ( isset( $webgatha_options['footer_above_content_enable'] ) && $webgatha_options['footer_above_content_enable'] ) {
if ( isset( $webgatha_options['footer_above_content_type'] ) && 'desc' === $webgatha_options['footer_above_content_type'] ) {
if ( isset( $webgatha_options['footer_above_content_desc'] ) && $webgatha_options['footer_above_content_desc'] ) {
$footer_above_content = $webgatha_options['footer_above_content_desc'];
}
} elseif ( isset( $webgatha_options['footer_above_content_static_block'] ) && $webgatha_options['footer_above_content_static_block'] ) {
$footer_above_content = $webgatha_options['footer_above_content_static_block'];
}
}
if ( ! empty( $footer_above_content ) ) {
?>
<div class="footer-above-content">
<div class="container">
<?php
if ( ( isset( $webgatha_options['footer_above_content_type'] ) && 'desc' === $webgatha_options['footer_above_content_type'] ) ) {
echo do_shortcode( $webgatha_options['footer_above_content_desc'] );
} else {
if ( function_exists( 'webgathacore_get_static_block' ) ) {
$static_block_content = webgathacore_get_static_block( $footer_above_content );
echo do_shortcode( $static_block_content );
}
}
?>
</div>
</div>
<?php
}
$footer_builder_elements = webgatha_get_custom_footer_data();
if ( $footer_builder_elements ) {
if ( isset( $footer_builder_elements['columns_settings'] ) && $footer_builder_elements['columns_settings'] ) {
$column_class = '';
?>
<div class="footer-widgets-wrapper">
<div class="footer">
<div class="container">
<div class="footer-widgets">
<div class="row">
<?php
foreach ( $footer_builder_elements['columns_settings'] as $columns_setting ) {
$footer_columns = '';
$footer_columns_tablet_landscape = '';
$footer_columns_tablet = '';
if ( isset( $columns_setting['footer_columns'] ) && $columns_setting['footer_columns'] ) {
$footer_columns = $columns_setting['footer_columns'];
}
if ( isset( $columns_setting['footer_columns_tablet_landscape'] ) && $columns_setting['footer_columns_tablet_landscape'] ) {
$footer_columns_tablet_landscape = $columns_setting['footer_columns_tablet_landscape'];
}
if ( isset( $columns_setting['footer_columns_tablet'] ) && $columns_setting['footer_columns_tablet'] ) {
$footer_columns_tablet = $columns_setting['footer_columns_tablet'];
}
$column_class = 'col-xl-' . $footer_columns . ' col-lg-' . $footer_columns_tablet_landscape . ' col-md-' . $footer_columns_tablet . ' col-sm-12 col-xs-12';
if ( isset( $columns_setting['columns_alignment'] ) && $columns_setting['columns_alignment'] ) {
$column_class .= ' footer-align-' . $columns_setting['columns_alignment'];
}
if ( isset( $columns_setting['hide_for_desktop'] ) && $columns_setting['hide_for_desktop'] ) {
$column_class .= ' hide-for-desktop';
}
if ( isset( $columns_setting['hide_for_mobile'] ) && $columns_setting['hide_for_mobile'] ) {
$column_class .= ' hide-for-mobile';
}
if ( isset( $columns_setting['hide_for_tablet'] ) && $columns_setting['hide_for_tablet'] ) {
$column_class .= ' hide-for-tablet';
}
?>
<div class="<?php echo esc_attr( $column_class ); ?>">
<?php
if ( isset( $columns_setting['footer_sidebar'] ) && $columns_setting['footer_sidebar'] ) {
dynamic_sidebar( $columns_setting['footer_sidebar'] );
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
<?php
}
} else {
$footer_rows = 1;
$footer_cols = 1;
$classes = array( 'col-lg-12 col-md-12 col-sm-12' );
$footer_widget_columns_alignment = array();
$footer_widget_columns = ( isset( $webgatha_options['footer_widget_columns'] ) && '' !== $webgatha_options['footer_widget_columns'] ) ? $webgatha_options['footer_widget_columns'] : 'three-columns';
if ( isset( $webgatha_options['footer_one_alignment'] ) && '' !== $webgatha_options['footer_one_alignment'] ) {
$footer_widget_columns_alignment[] = 'footer-align-' . $webgatha_options['footer_one_alignment'];
}
if ( isset( $webgatha_options['footer_two_alignment'] ) && '' !== $webgatha_options['footer_two_alignment'] ) {
$footer_widget_columns_alignment[] = 'footer-align-' . $webgatha_options['footer_two_alignment'];
}
if ( isset( $webgatha_options['footer_three_alignment'] ) && '' !== $webgatha_options['footer_three_alignment'] ) {
$footer_widget_columns_alignment[] = 'footer-align-' . $webgatha_options['footer_three_alignment'];
}
if ( isset( $webgatha_options['footer_four_alignment'] ) && '' !== $webgatha_options['footer_four_alignment'] ) {
$footer_widget_columns_alignment[] = 'footer-align-' . $webgatha_options['footer_four_alignment'];
}
if ( isset( $webgatha_options['footer_five_alignment'] ) && '' !== $webgatha_options['footer_five_alignment'] ) {
$footer_widget_columns_alignment[] = 'footer-align-' . $webgatha_options['footer_five_alignment'];
}
if ( isset( $webgatha_options['footer_six_alignment'] ) && '' !== $webgatha_options['footer_six_alignment'] ) {
$footer_widget_columns_alignment[] = 'footer-align-' . $webgatha_options['footer_six_alignment'];
}
if ( isset( $webgatha_options['footer_seven_alignment'] ) && '' !== $webgatha_options['footer_seven_alignment'] ) {
$footer_widget_columns_alignment[] = 'footer-align-' . $webgatha_options['footer_seven_alignment'];
}
if ( empty( $footer_widget_columns_alignment ) ) {
$footer_widget_columns_alignment[] = 'footer-align-left';
}
/**
* Filters footer widget columns.
*
* @param string $widget_column Name of widget column option.
*
* @visible true
*/
$footer_widget_columns = apply_filters( 'webgatha_footer_widget_columns', $footer_widget_columns );
/**
* Filters footer widget columns alignment.
*
* @param array $columns_alignment Array of columns alignment.
*
* @visible true
*/
$footer_widget_columns_alignment = apply_filters( 'webgatha_footer_widget_columns_alignment', $footer_widget_columns_alignment );
if ( isset( $footer_widget_columns ) ) {
switch ( $footer_widget_columns ) {
case 'two-columns':
$footer_cols = 2;
$classes = array( 'col-lg-6 col-md-6' );
break;
case 'three-columns':
$footer_cols = 3;
$classes = array( 'col-lg-4 col-md-4' );
break;
case 'four-columns':
$footer_cols = 4;
$classes = array( 'col-lg-3 col-md-6' );
break;
case '8-4-columns':
$footer_cols = 2;
$classes = array( 'col-lg-8 col-md-6', 'col-lg-4 col-md-6' );
break;
case '4-8-columns':
$footer_cols = 2;
$classes = array( 'col-lg-4 col-md-6', 'col-lg-8 col-md-6' );
break;
case '6-3-3-columns':
$footer_cols = 3;
$classes = array( 'col-lg-6 col-md-4', 'col-lg-3 col-md-4', 'col-lg-3 col-md-4' );
break;
case '3-3-6-columns':
$footer_cols = 3;
$classes = array( 'col-lg-3 col-md-4', 'col-lg-3 col-md-4', 'col-lg-6 col-md-4' );
break;
case '8-2-2-columns':
$footer_cols = 3;
$classes = array( 'col-xl-8 col-lg-6 col-md-4', 'col-xl-2 col-lg-3 col-md-4', 'col-xl-2 col-lg-3 col-md-4' );
break;
case '2-2-8-columns':
$footer_cols = 3;
$classes = array( 'col-xl-2 col-lg-3 col-md-4', 'col-xl-2 col-lg-3 col-md-4', 'col-xl-8 col-lg-6 col-md-4' );
break;
case '6-2-2-2-columns':
$footer_cols = 4;
$classes = array( 'col-xl-6 col-lg-3 col-md-6 col-sm-12', 'col-xl-2 col-lg-3 col-md-6 col-sm-12', 'col-xl-2 col-lg-3 col-md-6 col-sm-12', 'col-xl-2 col-lg-3 col-md-6 col-sm-12' );
break;
case '2-2-2-6-columns':
$footer_cols = 4;
$classes = array( 'col-xl-2 col-lg-3 col-md-6 col-sm-12', 'col-xl-2 col-lg-3 col-md-6 col-sm-12', 'col-xl-2 col-lg-3 col-md-6 col-sm-12', 'col-xl-6 col-lg-3 col-md-6 col-sm-12' );
break;
case '2-2-4-4-columns':
$footer_cols = 4;
$classes = array( 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-4 col-lg-4 col-md-6 col-sm-12', 'col-xl-4 col-lg-4 col-md-6 col-sm-12' );
break;
case '3-3-2-2-2-columns':
$footer_cols = 5;
$classes = array( 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12' );
break;
case '2-2-2-3-3-columns':
$footer_cols = 5;
$classes = array( 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12' );
break;
case '3-2-2-2-3-columns':
$footer_cols = 5;
$classes = array( 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12' );
break;
case '6-6-3-3-3-3-columns':
$footer_rows = 2;
$footer_cols = 6;
$footer_first_cols = 2;
$footer_second_cols = 4;
$classes = array( 'col-xl-6 col-lg-6 col-md-6', 'col-xl-6 col-lg-6 col-md-6', 'col-xl-3 col-lg-3 col-md-6', 'col-xl-3 col-lg-3 col-md-6', 'col-xl-3 col-lg-3 col-md-6', 'col-xl-3 col-lg-3 col-md-6' );
break;
case '6-6-2-2-2-2-4-columns':
$footer_rows = 2;
$footer_cols = 7;
$footer_first_cols = 2;
$footer_second_cols = 5;
$classes = array( 'col-xl-6 col-lg-6 col-md-6', 'col-xl-6 col-lg-6 col-md-6', 'col-xl-2 col-lg-2 col-md-6', 'col-xl-2 col-lg-2 col-md-6', 'col-xl-2 col-lg-2 col-md-6', 'col-xl-2 col-lg-2 col-md-6', 'col-xl-4 col-lg-4 col-md-6' );
break;
case '12-2-2-2-2-4-columns':
$footer_rows = 2;
$footer_cols = 6;
$footer_first_cols = 1;
$footer_second_cols = 5;
$classes = array( 'col-xl-12 col-lg-12 col-md-12 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-2 col-lg-2 col-md-6 col-sm-12', 'col-xl-4 col-lg-4 col-md-6 col-sm-12' );
break;
case '12-3-3-3-3-columns':
$footer_rows = 2;
$footer_cols = 5;
$footer_first_cols = 1;
$footer_second_cols = 4;
$classes = array( 'col-xl-12 col-lg-12 col-md-12 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12', 'col-xl-3 col-lg-3 col-md-6 col-sm-12' );
break;
case '2-2-2-2-2-2-columns':
$footer_cols = 6;
$classes = array( 'col-md-2 col-sm-4', 'col-md-2 col-sm-4', 'col-md-2 col-sm-4', 'col-md-2 col-sm-4', 'col-md-2 col-sm-4', 'col-md-2 col-sm-4' );
break;
}
}
$sidebar_content = 0;
for ( $col = 1; $col <= $footer_cols; $col++ ) {
if ( is_active_sidebar( 'sidebar-footer-' . $col ) ) {
$sidebar_content++;
}
}
if ( $sidebar_content > 0 ) {
if ( $footer_rows > 1 ) {
$footer_col = $footer_first_cols;
} else {
$footer_col = $footer_cols;
}
?>
<div class="footer-widgets-wrapper">
<div class="footer"><!-- .footer -->
<div class="container"><!-- .container -->
<div class="footer-widgets">
<div class="row">
<?php
for ( $col = 1; $col <= $footer_col; $col++ ) {
if ( ! isset( $classes[ $col - 1 ] ) ) {
$classes[ $col - 1 ] = $classes[0];
}
$counter_class = isset( $classes[ $col - 1 ] ) ? $classes[ $col - 1 ] : '';
$counter_class .= isset( $footer_widget_columns_alignment[ $col - 1 ] ) ? ' ' . $footer_widget_columns_alignment[ $col - 1 ] : '';
?>
<div class="<?php echo esc_attr( $counter_class ); ?>">
<?php dynamic_sidebar( 'sidebar-footer-' . $col ); ?>
</div>
<?php
}
?>
</div>
<?php
if ( $footer_rows > 1 ) {
?>
<div class="row">
<?php
for ( $col = $footer_first_cols + 1; $col <= $footer_cols; $col++ ) {
$counter_class = isset( $classes[ $col - 1 ] ) ? $classes[ $col - 1 ] : '';
$counter_class .= isset( $footer_widget_columns_alignment[ $col - 1 ] ) ? ' ' . $footer_widget_columns_alignment[ $col - 1 ] : '';
?>
<div class="<?php echo esc_attr( $counter_class ); ?>">
<?php dynamic_sidebar( 'sidebar-footer-' . $col ); ?>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
</div><!-- .container -->
</div><!-- .footer -->
</div>
<?php
}
}