Skip to:

[Resolved] Display Custom Post Types in Activity Feed

  • Hello, our company uses BuddyPress to power our website. To extend our StudioPress theme to work on BuddyPress, we use GenesisConnect. Our website, uses custom post types called “videos” and “pictures”. I’ve tried various variations of code (Don’t have any of the snippets on me right now) in the functions.php file of the theme that I found googling. Sadly, I’ve had no success with anything. Does anyone have a snippet that they can confirm working to show custom post type post creations in the feed on the latest version of BP?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Profile photo of Roger Coathup
    Roger Coathup


    BuddyPress provides a filter to let you do this.

    If you look through the code for recording a post (hooked on save_post) in the bp-blogs component, you should be able to figure out how to use it.

    Still no luck using the code for bp-blogs in my functions.php:

    Edit: nvm, got it working, figured it out. Need to have BuddyPress aware of new content.

    Profile photo of 4ella


    Hello , can you please publish here your solution ? I would be glad to see my new custom post types in activity too, to create new custom post type “portfolio” I use gravity forms

    Profile photo of Roger Coathup
    Roger Coathup


    Your solution: copying the whole BuddyPress function and changing one line is not the best way to do this.

    As I suggested earlier — that BuddyPress function has a filter for the post types it works with: bp_blogs_record_post_post_types

    All you need to do is register a filter that adds your custom post types to the array of post types.

    Here’s a better solution then:

    Profile photo of shanebp



    This approach might be safer for most people.
    It adds to the recorded post_types instead of replacing them.

    add_filter ( ‘bp_blogs_record_post_post_types’, ‘activity_publish_custom_post_types’,1,1 );
    function activity_publish_custom_post_types( $post_types ) {
    $post_types[] = ‘videos’;
    $post_types[] = ‘pictures’;
    return $post_types;

    And if you go thru the trouble of creating a CPT, why not filter the activity action so it isn’t the generic ‘…wrote a new post’. For example:

    add_filter(‘bp_blogs_activity_new_post_action’, ‘record_cpt_activity_action’, 1, 3);
    function record_cpt_activity_action( $activity_action, $post, $post_permalink ) {
    global $bp;
    if( $post->post_type == ‘videos’ ) {
    if ( is_multisite() )
    $activity_action = sprintf( __( ‘%1$s created a new Videos post, %2$s, on the site %3$s’, ‘buddypress’ ), bp_core_get_userlink( (int) $post->post_author ), ‘‘ . $post->post_title . ‘‘, ‘‘ . get_blog_option( $blog_id, ‘blogname’ ) . ‘‘ );

    $activity_action = sprintf( __( ‘%1$s created a new Videos post, %2$s’, ‘buddypress’ ), bp_core_get_userlink( (int) $post->post_author ), ‘‘ . $post->post_title . ‘‘ );


    return $activity_action;

    Thanks. You’re right, the first approach would be safer for most people. I kept my approach because I didn’t want anything else besides videos and pictures showing in the stream. As for the second snippet, already got one working but didn’t get a chance to post it, so thanks a lot for sharing!

    Profile photo of Maxaud


    I’m curious, how can we add a sort option like the “mentions” tab for this custom activity?

    A way to view view strictly the activity for this custom post type.

    Profile photo of Cidade Sonho
    Cidade Sonho


    Thanks *-*

    Profile photo of esscott


    I hate to have to ask, but where does the above code need to be inserted? Will it work in 1.7?

    Profile photo of shanebp


    Put it in bp-custom.php – after you remove all the ‘br’ tags.

    Should be fine in 1.7

    Profile photo of thecorkboard


    Thanks, @shanebp, that worked like a charm. The only issue I have is that it the content type is being posted with the “mini” class instead of as a normal size in the activity stream. Any thoughts on how to remove that class?

    Profile photo of richtelford


    I’ve been working on my first BuddyPress site last couple of weeks so stumbling around forum posts quite a lot.

    You’ve probably already found a fix @thecorkboard but I used the “bp_get_activity_css_class” to strip out the “mini” class when not required.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Display Custom Post Types in Activity Feed’ is closed to new replies.
Skip to toolbar