Create a custom BuddyPress widget to display personalized content.
// Register a custom BuddyPress widget
function register_buddypress_custom_widget() {
register_widget('BuddyPress_Custom_Widget');
}
class BuddyPress_Custom_Widget extends WP_Widget {
function __construct() {
parent::__construct('bp_custom_widget', 'BuddyPress Custom Widget');
}
function widget($args, $instance) {
echo '<div class="bp-custom-widget">';
echo '<p>Custom widget content</p>';
echo '</div>';
}
}
add_action('widgets_init', 'register_buddypress_custom_widget');