/** * Echo the markup necessary to facilitate the footer widget areas. * * Check for a numerical parameter given when adding theme support - if none is found, then the function returns early. * * The child theme must style the widget areas. * * Applies the `genesis_footer_widget_areas` filter. * * @since 1.6.0 * * @uses genesis_structural_wrap() Optionally adds wrap with footer-widgets context. * * @return null Return early if number of widget areas could not be determined, or nothing is added to the first widget area. */ function genesis_footer_widget_areas() { $footer_widgets = get_theme_support('genesis-footer-widgets'); if (!$footer_widgets || !isset($footer_widgets[0]) || !is_numeric($footer_widgets[0])) { return; } $footer_widgets = (int) $footer_widgets[0]; //* Check to see if first widget area has widgets. If not, do nothing. No need to check all footer widget areas. if (!is_active_sidebar('footer-1')) { return; } $inside = ''; $output = ''; $counter = 1; while ($counter <= $footer_widgets) { //* Darn you, WordPress! Gotta output buffer. ob_start(); dynamic_sidebar('footer-' . $counter); $widgets = ob_get_clean(); if ($widgets) { $inside .= sprintf('<div class="footer-widgets-%d widget-area">%s</div>', $counter, $widgets); } $counter++; } if ($inside) { $output .= genesis_markup(array('html5' => '<div %s>' . genesis_sidebar_title('Footer'), 'xhtml' => '<div id="footer-widgets" class="footer-widgets">', 'context' => 'footer-widgets', 'echo' => false)); $output .= genesis_structural_wrap('footer-widgets', 'open', 0); $output .= $inside; $output .= genesis_structural_wrap('footer-widgets', 'close', 0); $output .= '</div>'; } echo apply_filters('genesis_footer_widget_areas', $output, $footer_widgets); }
function foundation_do_header() { global $wp_registered_sidebars; genesis_markup(array('html5' => '<div %s>', 'xhtml' => '<div class="top-bar-left">', 'context' => 'top-bar-left')); do_action('genesis_site_title'); do_action('genesis_site_description'); echo '</div>'; if (isset($wp_registered_sidebars['header-right']) && is_active_sidebar('header-right') || has_action('genesis_header_right')) { genesis_markup(array('html5' => '<div %s>' . genesis_sidebar_title('header-right'), 'context' => 'top-bar-right')); do_action('genesis_header_right'); add_filter('wp_nav_menu_args', 'genesis_header_menu_args'); add_filter('wp_nav_menu', 'genesis_header_menu_wrap'); dynamic_sidebar('header-right'); remove_filter('wp_nav_menu_args', 'genesis_header_menu_args'); remove_filter('wp_nav_menu', 'genesis_header_menu_wrap'); echo '</div>'; } }
<?php /** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Templates * @author StudioPress * @license GPL-2.0+ * @link http://my.studiopress.com/themes/genesis/ */ // Output secondary sidebar structure. genesis_markup(array('open' => '<aside %s>' . genesis_sidebar_title('sidebar-alt'), 'context' => 'sidebar-secondary')); do_action('genesis_before_sidebar_alt_widget_area'); do_action('genesis_sidebar_alt'); do_action('genesis_after_sidebar_alt_widget_area'); // End .sidebar-secondary. genesis_markup(array('close' => '</aside>', 'context' => 'sidebar-secondary'));
<?php /** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Templates * @author StudioPress * @license GPL-2.0+ * @link http://my.studiopress.com/themes/genesis/ */ //* Output primary sidebar structure genesis_markup(array('html5' => '<aside %s>' . genesis_sidebar_title('sidebar'), 'xhtml' => '<div id="sidebar" class="sidebar widget-area">', 'context' => 'sidebar-primary')); do_action('genesis_before_sidebar_widget_area'); do_action('genesis_sidebar'); do_action('genesis_after_sidebar_widget_area'); genesis_markup(array('html5' => '</aside>', 'xhtml' => '</div>'));
/** * Filters the footer widget area because with the Genesis function it's not possible to apply Bootstrap grid classes to the widgets dynamically in a proper way. * Defines an action to insert the footer widgets. * * See example code in functions.php * * @since 1.0.0 * * Reference: genesis/lib/structure/footer.php */ function mov_footer_widget_areas($output) { genesis_markup(array('html5' => '<div %s>' . genesis_sidebar_title('Footer'), 'xhtml' => '<div id="footer-widgets" class="footer-widgets">', 'context' => 'footer-widgets')); echo genesis_structural_wrap('footer-widgets', 'open', 0); do_action('mov_footer_widgets_output'); echo genesis_structural_wrap('footer-widgets', 'close', 0); echo '</div>'; }
/** * Conditionally display a sidebar, wrapped in a div by default. * * The $args array accepts the following keys: * * - `before` (markup to be displayed before the widget area output), * - `after` (markup to be displayed after the widget area output), * - `default` (fallback text if the sidebar is not found, or has no widgets, default is an empty string), * - `show_inactive` (flag to show inactive sidebars, default is false), * - `before_sidebar_hook` (hook that fires before the widget area output), * - `after_sidebar_hook` (hook that fires after the widget area output). * * Return false early if the sidebar is not active and the `show_inactive` argument is false. * * @since 1.8.0 * * @param string $id Sidebar ID, as per when it was registered. * @param array $args Arguments. * @return bool `false` if `$id` is falsy, or `$args['show_inactive']` is falsy and sidebar * is not currently being used. `true` otherwise. */ function genesis_widget_area($id, $args = array()) { if (!$id) { return false; } $defaults = apply_filters('genesis_widget_area_defaults', array('before' => genesis_html5() ? '<aside class="widget-area">' . genesis_sidebar_title($id) : '<div class="widget-area">', 'after' => genesis_html5() ? '</aside>' : '</div>', 'default' => '', 'show_inactive' => 0, 'before_sidebar_hook' => 'genesis_before_' . $id . '_widget_area', 'after_sidebar_hook' => 'genesis_after_' . $id . '_widget_area'), $id, $args); $args = wp_parse_args($args, $defaults); if (!is_active_sidebar($id) && !$args['show_inactive']) { return false; } // Opening markup. echo $args['before']; // Before hook. if ($args['before_sidebar_hook']) { do_action($args['before_sidebar_hook']); } if (!dynamic_sidebar($id)) { echo $args['default']; } // After hook. if ($args['after_sidebar_hook']) { do_action($args['after_sidebar_hook']); } // Closing markup. echo $args['after']; return true; }
<?php /** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Templates * @author StudioPress * @license GPL-2.0+ * @link http://my.studiopress.com/themes/genesis/ */ // Output primary sidebar structure. genesis_markup(array('open' => '<aside %s>' . genesis_sidebar_title('sidebar'), 'context' => 'sidebar-primary')); do_action('genesis_before_sidebar_widget_area'); do_action('genesis_sidebar'); do_action('genesis_after_sidebar_widget_area'); // End .sidebar-primary. genesis_markup(array('close' => '</aside>', 'context' => 'sidebar-primary'));
/** * Echo the default header, including the #title-area div, along with #title and #description, as well as the .widget-area. * * Does the `genesis_site_title`, `genesis_site_description` and `genesis_header_right` actions. * * @since 1.0.2 * * @global $wp_registered_sidebars Holds all of the registered sidebars. */ function genesis_do_header() { global $wp_registered_sidebars; genesis_markup(array('open' => '<div %s>', 'context' => 'title-area')); do_action('genesis_site_title'); do_action('genesis_site_description'); genesis_markup(array('close' => '</div>', 'context' => 'title-area')); if (isset($wp_registered_sidebars['header-right']) && is_active_sidebar('header-right') || has_action('genesis_header_right')) { genesis_markup(array('open' => '<div %s>' . genesis_sidebar_title('header-right'), 'context' => 'header-widget-area')); do_action('genesis_header_right'); add_filter('wp_nav_menu_args', 'genesis_header_menu_args'); add_filter('wp_nav_menu', 'genesis_header_menu_wrap'); dynamic_sidebar('header-right'); remove_filter('wp_nav_menu_args', 'genesis_header_menu_args'); remove_filter('wp_nav_menu', 'genesis_header_menu_wrap'); genesis_markup(array('close' => '</div>', 'context' => 'header-widget-area')); } }