How-To create widget area to each component
-
Waiting someone create plugin allowing to display different widget on each buddypress component (members, groups, forum repository, search, page, post, 404, etc..), I’ve tested a trick wich does work easy. This tutorial helped me http://buddydress.com/2010/04/add-a-widget-anywhere-in-3-simple-steps/
1) duplicate sidebar.php and rename this : sidebar-members.php to each component you want customize.
2) on yours news sidebar-xxxxx.php, find this : and replace ‘sidebar’ with currently name of your file without ‘.php’ (if you are on sidebar-members.php, put ‘sidebar-members’).
3) create fonctions on functions.php : add :
array(
‘name’ => ‘Sidebar-xxxxxxx’,
‘before_widget’ => ‘‘,
‘after_widget’ => ‘‘,
‘before_title’ => ‘‘,
‘after_title’ => ‘‘
)
);e.g. :
register_sidebars( 1,
array(
‘name’ => ‘Sidebar-search’,
‘before_widget’ => ‘‘,
‘after_widget’ => ‘‘,
‘before_title’ => ‘‘,
‘after_title’ => ‘‘
)
);register_sidebars( 1,
array(
‘name’ => ‘Sidebar-404’,
‘before_widget’ => ‘‘,
‘after_widget’ => ‘‘,
‘before_title’ => ‘‘,
‘after_title’ => ‘‘
)
);register_sidebars( 1,
array(
‘name’ => ‘Sidebar-activity’,
‘before_widget’ => ‘‘,
‘after_widget’ => ‘‘,
‘before_title’ => ‘‘,
‘after_title’ => ‘‘
)
);4) call new sidebar area in your components. To each component template, you must have home.php or index.php wich has at the end of the code. Replace ‘sidebar.php’ with ‘sidebar-xxxxx.php’ of your choice.
5) Check the results in your widget admin and enjoy
Excuse my english !
- The topic ‘How-To create widget area to each component’ is closed to new replies.