Favourites in Sidebar
-
Hi all,
I have been trying to add Favourites for the logged in user to the sidebar.
I have created a simple plugin that adds a widget to the sidebar, the problem is I cannot make the widget show activities or favourites in its content.I took the widget code from wordpress codex I guess:
Here’s the part that should show the content:
// Creating widget front-end
// This is where the action happens
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );// before and after widget arguments are defined by themes
echo $args['before_widget'];
if ( ! empty( $title ) )
echo $args['before_title'] . $title . $args['after_title'];// This is where you run the code and display the output
echo __( 'my user id is: ', 'wpb_widget_domain' );
echo bp_loggedin_user_id();
// the above 2 lines make it show my user id, this is just for testing// here I want to add my favourites, I found this to filter the activities
// if ( bp_has_activities( bp_ajax_querystring( 'activity' ).'&scope=favourites' ) ) :
// but I don't know how to place it here, whatever way I try it either returns an error or nothingif ( bp_has_activities( bp_ajax_querystring( 'activity' ).'&scope=favourites' ) ) :
echo $args['after_widget'];
}
Can you please tell me how to make it.
Thank you!
Leo
- The topic ‘Favourites in Sidebar’ is closed to new replies.