<?php if (is_active_sidebar_YA('above-main')) { ?> <div class="sidebar-above-main"> <div class="row"> <?php dynamic_sidebar('above-main'); ?> </div> </div> <?php } ?> <div class="row"> <?php if ($left_sidebars = ya_sidebar_left()) { foreach ($left_sidebars as $sidebar) { get_template_part('templates/sidebar', $sidebar); } } ?> <section id="contents" <?php ya_content_class(); ?> role="main"> <?php if (is_active_sidebar_YA('above')) { ?> <div class="sidebar-above">
function ya_content_class() { $classes = array('content'); $all_sidebars = array_merge(ya_sidebar_left(), ya_sidebar_right()); $all_sidebars = array_unique($all_sidebars); $span = 12; $span_md = 12; $span_sm = 12; foreach ($all_sidebars as $sb) { if (!is_active_sidebar_YA($sb)) { continue; } $sb_expand_field = 'sidebar_' . $sb . '_expand'; $sb_expand_field_md = 'sidebar_' . $sb . '_expand_md'; $sb_expand_field_sm = 'sidebar_' . $sb . '_expand_sm'; $sb_expand_value = ya_options()->getCpanelValue($sb_expand_field); $sb_expand_value_md = ya_options()->getCpanelValue($sb_expand_field_md); $sb_expand_value_sm = ya_options()->getCpanelValue($sb_expand_field_sm); $span -= (int) $sb_expand_value; $span_md -= (int) $sb_expand_value_md; $span_sm -= (int) $sb_expand_value_sm; } if ($span <= 0 || $span_md <= 0 || $span_sm <= 0) { $classes[] = 'col-lg-12 col-md-12 col-sm-12'; } else { $classes[] = 'col-lg-' . $span . ' col-md-' . $span_md . ' col-sm-' . $span_sm; } echo 'class="' . join(' ', $classes) . '"'; }