Filtering bp_get_activity_content_body, bp_get_activity_secondary_item_id
-
I’m trying to filter the activity content body, but bp_get_activity_secondary_item_id keeps returning 0. What I want is, when users comment on a post with a featured image, for that image to appear appended to the activity body. Here’s what I’m using:
add_filter( 'bp_get_activity_content_body', 'cshp_add_thumbs_to_activity', 0, 1 ); function cshp_add_thumbs_to_activity( $bp_activity_filter_kses, $number ){ $post_id = bp_get_activity_secondary_item_id(); if( has_post_thumbnail( get_post( $post_id ) ) ) $attachment = wp_get_attachment_image( $post_id ); $new_content = $attachment ? $bp_activity_filter_kses . "<br />\n" . $attachment : $bp_activity_filter_kses; return $new_content; }
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Filtering bp_get_activity_content_body, bp_get_activity_secondary_item_id’ is closed to new replies.