Skip to content

Instantly share code, notes, and snippets.

@scottopolis
Last active October 18, 2018 15:18
Show Gist options
  • Save scottopolis/8ad93b2675d3dc34f2fbd1fd591ffccb to your computer and use it in GitHub Desktop.
Save scottopolis/8ad93b2675d3dc34f2fbd1fd591ffccb to your computer and use it in GitHub Desktop.
BuddyBoss Media for AppCommunity
<?php
// add this code to a plugin
add_filter('appcommunity_activity_content', function( $content, $id ) {
if( !function_exists('buddyboss_media_compat_get_meta') ) {
return $content;
}
$media_ids = buddyboss_media_compat_get_meta( $id, 'activity.item_keys' );
if( empty( $media_ids ) || !is_array( $media_ids ) ) {
return $content;
}
$image = wp_get_attachment_image_src( $media_ids[0], 'medium' );
return $content . '<img src="' . $image[0] . '" class="buddyboss-wall-photo" />';
}, 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment