BuddyDev

Search

[Resolved] Is it possible to show media or gallery for current group only in shortcode?

  • Participant
    Level: Initiated
    Posts: 7
    Cheryl on #50890

    Hello,

    I see that you can list media or galleries by shortcode with the parameter in the shortcode as compenent=groups, for instace, to show only group galleries or media.

    But is there any way to show only media for the CURRENT group so, for instance, you could show the photos for the current group in the sidebar widget for that specific group?

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24238
    Brajesh Singh on #50901

    Hi Cheryl,
    Thank you for the question.
    With a small snippet of code, you can easily achieve it.

    
    add_filter( 'mpp_shortcode_list_media_query_args', function ( $atts ) {
    
    	if ( bp_is_group() ) {
    		$atts['component']    = 'groups';
    		$atts['component_id'] = bp_get_current_group_id();
    	}
    
    	return $atts;
    } );
    
    

    we will add the support for current group in future version in the plugin itself.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 7
    Cheryl on #50912

    Thank you!
    Worked great and I changed it to do the same for galleries.
    Again, thanks!!!
    Cheryl

  • Keymaster
    (BuddyDev Team)
    Posts: 24238
    Brajesh Singh on #50916

    Hi Cheryl,
    Thank you for confirming. I am glad you used it and adopted for galleries.

    Have a great day!

    Regards
    Brajesh

The topic ‘ [Resolved] Is it possible to show media or gallery for current group only in shortcode?’ is closed to new replies.

This topic is: resolved