function layers_woocommerce_center_column_class($classes) { if (!function_exists('is_shop')) { return $classes; } else { if (!is_shop() && !is_post_type_archive('product') && !is_singular('product') && !is_tax('product_cat') && !is_tax('product_tag')) { return $classes; } } $left_sidebar_active = layers_can_show_sidebar('left-woocommerce-sidebar'); $right_sidebar_active = layers_can_show_sidebar('right-woocommerce-sidebar'); // Unset default classes foreach ($classes as $key => $this_class) { if ('span-6' == $this_class) { unset($classes[$key]); } else { if ('span-9' == $this_class) { unset($classes[$key]); } else { if ('span-12' == $this_class) { unset($classes[$key]); } else { if ('span-8' == $this_class) { unset($classes[$key]); } else { if ('no-gutter' == $this_class) { unset($classes[$key]); } } } } } } // Set post classes if ($left_sidebar_active && $right_sidebar_active) { $classes[] = 'span-6'; } else { if ($left_sidebar_active) { $classes[] = 'span-9'; } else { if ($right_sidebar_active) { $classes[] = 'span-9'; } else { $classes[] = 'span-12'; } } } // If there is a left sidebar and no right sidebar, add the no-gutter class if ($left_sidebar_active && !$right_sidebar_active) { $classes[] = 'no-gutter'; } return $classes; }
/** * Adjust the content width when the full width page template is being used */ function layers_set_content_width() { global $content_width; $left_sidebar_active = layers_can_show_sidebar('left-sidebar'); $right_sidebar_active = layers_can_show_sidebar('right-sidebar'); if (is_page_template(LAYERS_BUILDER_TEMPLATE)) { $content_width = 1080; } else { if (is_page_template('template-both-sidebar.php') || is_page_template('template-left-sidebar.php') || is_page_template('template-right-sidebar.php')) { $content_width = 660; } elseif (is_page_template('template-blog.php')) { $content_width = 1080; } elseif ($left_sidebar_active || $right_sidebar_active) { $content_width = 660; } } }
<?php /** * Maybe show the left sidebar */ $sidebar_class = apply_filters('layers_left_sidebar_class', array('column', 'pull-left', 'sidebar', layers_can_show_sidebar('right-sidebar') ? 'span-3' : 'span-4')); layers_maybe_get_sidebar('left-sidebar', implode(' ', $sidebar_class));
function layers_maybe_get_sidebar($sidebar = 'left', $container_class = 'column', $return = FALSE) { global $post; $show_sidebar = layers_can_show_sidebar($sidebar); if (TRUE == $show_sidebar) { ?> <?php if (is_active_sidebar(LAYERS_THEME_SLUG . '-' . $sidebar)) { ?> <div class="<?php echo esc_attr($container_class); ?> "> <?php } ?> <?php dynamic_sidebar(LAYERS_THEME_SLUG . '-' . $sidebar); ?> <?php if (is_active_sidebar(LAYERS_THEME_SLUG . '-' . $sidebar)) { ?> </div> <?php } ?> <?php } }
<?php /** * Maybe show the right sidebar */ $sidebar_class = apply_filters('layers_right_sidebar_class', array('column', 'pull-right', 'sidebar', 'no-gutter', layers_can_show_sidebar('left-sidebar') ? 'span-3' : 'span-4')); layers_maybe_get_sidebar('right-sidebar', implode(' ', $sidebar_class));
<?php /** * Maybe show the right sidebar */ $sidebar_class = layers_can_show_sidebar('left-sidebar') ? 'span-3' : 'span-4'; layers_maybe_get_sidebar('right-sidebar', 'column pull-right sidebar no-gutter ' . $sidebar_class);