Skip to content
Browse files

Updated how sidebars are set up.

  • Loading branch information...
1 parent b11d795 commit 3d11120a8878f5693c90395fb991d591c50ff61e @jasonn committed May 17, 2011
Showing with 14 additions and 23 deletions.
  1. +13 −14 framework/core/widgets.php
  2. +0 −1 framework/framework.php
  3. +1 −8 framework/widgets/recent-posts-custom.php
View
27 framework/core/widgets.php
@@ -9,22 +9,21 @@
* register_widgets()
*
*/
-function register_widgets($name=null, $id=null) {
- $defaults = array(
- 'name' => null,
- 'id' => null,
- 'before_widget' => '<section id="%1$s" class="widget %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<h3>',
- 'after_title' => '</h3>',
- );
- $defaults["name"] = $name;
- $defaults["id"] = $id;
- $args = apply_filters( 'register_widgets', (array) $defaults ); // Available filter: register_widgets
- $how_many = apply_filters( 'register_widgets_count', (int) 1 ); // Available filter: widget_count
- register_sidebars( $how_many, $args );
+
+function sidebars_init($sidebars) {
+ foreach($sidebars as $sb) {
+ register_sidebar(array(
+ 'name'=> $sb,
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<h3 class="widget-title">',
+ 'after_title' => '</h3>',
+ ));
+ }
}
+add_action( 'widgets_init', sidebars_init(array('Sidebar')) );
+
/**
* widget_area_active() Checks to see if a widget area is active based on ID
*
View
1 framework/framework.php
@@ -89,7 +89,6 @@ function defaults() {
function ready() {
if (file_exists(FRAMEWORK . '/functions.php')) include_once(FRAMEWORK . '/functions.php'); // include custom-functions.php if that file exist
do_action('framework_init'); // Available action: framework_init
- register_widgets();
}
} // end of ThemeFramework;
View
9 framework/widgets/recent-posts-custom.php
@@ -180,13 +180,6 @@ function form($instance) {
/**
* Add function to widgets_init that'll load our widgets.
*/
-add_action( 'widgets_init', 'load_widgets' );
-
-/**
- * Register widgets.
- */
-function load_widgets() {
- register_widget( 'RecentPostsWidget' );
-}
+add_action('widgets_init', create_function('', 'return register_widget("RecentPostsWidget");'));
?>

0 comments on commit 3d11120

Please sign in to comment.
Something went wrong with that request. Please try again.