BuddyDev

Search

[Resolved] Show number of pics in album list

  • Participant
    Level: Enlightened
    Posts: 32
    Terjemk on #1232

    Hi,

    When a user creates an gallery I would like it to show how many pictures the gallery contains. How do I edit this? Right now it seems like it is only one picture in the gallery when viewing a users galry listings.

    Regards
    Terjemk

  • Keymaster
    (BuddyDev Team)
    Posts: 21067
    Brajesh Singh on #1233

    Hi Terjemk,
    Thank you for posting the topic.
    It is easily doable. Can you please post me a screenshot and point me where would you like to see the count. I will post the code that will enable it.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 32
    Terjemk on #1235

    http://www.mactosh.net/image/gallery.jpg

    Right where the red arrow points.

  • Keymaster
    (BuddyDev Team)
    Posts: 21067
    Brajesh Singh on #1238

    Hi,
    here is the code

    
    add_filter( 'mpp_get_gallery_title', 'mpp_custom_inject_media_count_in_gallery_title', 10, 2 );
    function mpp_custom_inject_media_count_in_gallery_title( $title , $gallery = null ) {
    	
    	
    	
    	//only show it on gallery home
    	if( mpp_is_gallery_home() ) {
    		
    		$gallery = mpp_get_gallery( $gallery );
    		
    		$count = absint( $gallery->media_count );
    		
    		return "({$count}) {$title}";
    	}
    	
    	return $title;
    }
    

    Please put it in your bp-custom.php or your theme’s functions.php and on user gallery page it will show the count.

  • Participant
    Level: Enlightened
    Posts: 32
    Terjemk on #1240

    Great! Thanks again

  • Keymaster
    (BuddyDev Team)
    Posts: 21067
    Brajesh Singh on #1249

    You are most welcome. Marking it as resolved now.

The topic ‘ [Resolved] Show number of pics in album list’ is closed to new replies.

This topic is: resolved