Пример #1
0
<?php

if (!is_active_sidebar('sidebar-footer-1') && !is_active_sidebar('sidebar-footer-2') && !is_active_sidebar('sidebar-footer-3') && !is_active_sidebar('sidebar-footer-4')) {
    return;
}
?>
<div class="container">
	<div class="et_pb_extra_row container-width-change-notify">
		<?php 
$footer_sidebars = array('sidebar-footer-1', 'sidebar-footer-2', 'sidebar-footer-3', 'sidebar-footer-4');
$footer_column_index = 0;
$footer_columns_visibility = extra_footer_columns_visibility();
foreach ($footer_sidebars as $footer_sidebar) {
    $footer_column_index++;
    $footer_columns_visibility_index = $footer_column_index - 1;
    if (is_active_sidebar($footer_sidebar) && (is_customize_preview() || !is_customize_preview() && $footer_columns_visibility[$footer_columns_visibility_index])) {
        ?>
				<div class="et_pb_extra_column <?php 
        echo 0 === $footer_column_index % 2 ? 'even' : 'odd';
        ?>
 <?php 
        esc_attr_e(sprintf('column-%s', $footer_column_index));
        ?>
">
					<?php 
        dynamic_sidebar($footer_sidebar);
        ?>
				</div>
				<?php 
    }
}
Пример #2
0
function extra_register_sidebars()
{
    $footer_columns = et_get_option('footer_columns', '3');
    switch ($footer_columns) {
        case '4':
            $footer_sidebar_names = array(__('Footer Sidebar Left', 'extra'), __('Footer Sidebar Middle Left', 'extra'), __('Footer Sidebar Middle Right', 'extra'), __('Footer Sidebar Right', 'extra'));
            break;
        case '3':
        case '1_4__1_4__1_2':
        case '1_2__1_4__1_4':
        case '1_4__1_2__1_4':
            $footer_sidebar_names = array(__('Footer Sidebar Left', 'extra'), __('Footer Sidebar Middle', 'extra'), __('Inactive Footer Sidebar', 'extra'), __('Footer Sidebar Right', 'extra'));
            break;
        case '1':
            $footer_sidebar_names = array(__('Footer Sidebar', 'extra'), __('Inactive Footer Sidebar', 'extra'), __('Inactive Footer Sidebar', 'extra'), __('Inactive Footer Sidebar', 'extra'));
            break;
        default:
            $footer_sidebar_names = array(__('Footer Sidebar Left', 'extra'), __('Inactive Footer Sidebar', 'extra'), __('Inactive Footer Sidebar', 'extra'), __('Footer Sidebar Right', 'extra'));
            break;
    }
    $sidebars = array(array('name' => __('Main Sidebar', 'extra')), array('name' => __('Project Sidebar', 'extra')));
    $footer_sidebars = array(array('name' => $footer_sidebar_names[0], 'id' => 'sidebar-footer-1'), array('name' => $footer_sidebar_names[1], 'id' => 'sidebar-footer-2'), array('name' => $footer_sidebar_names[2], 'id' => 'sidebar-footer-3'), array('name' => $footer_sidebar_names[3], 'id' => 'sidebar-footer-4'));
    if (!is_customize_preview()) {
        foreach (extra_footer_columns_visibility() as $key => $visibility) {
            if (!$visibility) {
                unset($footer_sidebars[$key]);
            }
        }
    }
    foreach (array_merge($sidebars, $footer_sidebars) as $sidebar) {
        _et_register_sidebar($sidebar);
    }
}