function x_widgets_init() { register_sidebar(array('name' => __('Main Sidebar', '__x__'), 'id' => 'sidebar-main', 'description' => __('Appears on posts and pages that include the sidebar.', '__x__'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h4 class="h-widget">', 'after_title' => '</h4>')); $i = 0; $n = x_header_widget_areas_count(); while ($i < $n) { $i++; register_sidebar(array('name' => __('Header ', '__x__') . $i, 'id' => 'header-' . $i, 'description' => __('Widgetized header area.', '__x__'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h4 class="h-widget">', 'after_title' => '</h4>')); } $i = 0; $n = x_footer_widget_areas_count(); while ($i < $n) { $i++; register_sidebar(array('name' => __('Footer ', '__x__') . $i, 'id' => 'footer-' . $i, 'description' => __('Widgetized footer area.', '__x__'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h4 class="h-widget">', 'after_title' => '</h4>')); } }
<?php // ============================================================================= // VIEWS/GLOBAL/_FOOTER-WIDGET-AREAS.PHP // ----------------------------------------------------------------------------- // Outputs the widget areas for the footer. // ============================================================================= $n = x_footer_widget_areas_count(); ?> <?php if ($n != 0) { ?> <footer class="x-colophon top" role="contentinfo"> <div class="x-container max width"> <?php $i = 0; while ($i < $n) { $i++; $last = $i == $n ? ' last' : ''; echo '<div class="x-column x-md x-1-' . $n . $last . '">'; dynamic_sidebar('footer-' . $i); echo '</div>'; } ?> </div>
function x_admin_body_class($classes) { $screen = get_current_screen(); $classes .= ' x-theme-active'; $classes .= ' x-' . x_get_stack(); if ($screen->base == 'widgets') { $classes .= ' x-header-widgets-' . x_header_widget_areas_count(); $classes .= ' x-footer-widgets-' . x_footer_widget_areas_count(); } return $classes; }