sprintf( 'footer-%d', $counter ), 'name' => sprintf( __( 'Footer %d', 'omega' ), $counter ), 'description' => sprintf( __( 'Footer %d widget area.', 'omega' ), $counter ) ); omega_register_sidebar( $defaults ); $counter++; } } add_action( 'omega_before_footer', 'omega_footer_widget_areas' ); /** * 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 `omega_footer_widget_areas` filter. * * @since 0.3.4 * * @uses omega_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 omega_footer_widget_areas() { $footer_widgets = get_theme_support( 'omega-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 ) { //* Gotta output buffer. ob_start(); dynamic_sidebar( 'footer-' . $counter ); $widgets = ob_get_clean(); $inside .= sprintf( '
', $counter, $widgets ); $counter++; } if ( $inside ) { $output .= ''; } echo apply_filters( 'omega_footer_widget_areas', $output, $footer_widgets ); }