How to include custom post type title in BuddyPress activity feed

I am using custom post types that I will be displaying within my BuddyPress activity feed. I am able to setup the post types to work within the feed just fine, but I am unable to find documentation about how to display the title within the feed. Here is my code, I want to display the post title where [title] is:

add_post_type_support( 'news', 'buddypress-activity' );

function customize_page_tracking_args() {
    // Check if the Activity component is active before using it.
    if ( ! bp_is_active( 'activity' ) ) {
        return;
    }

    bp_activity_set_post_type_tracking_args( 'news', array(
        'component_id'             => buddypress()->blogs->id,
        'action_id'                => 'new_news_item',
        'bp_activity_admin_filter' => __( 'News', 'custom-domain' ),
        'bp_activity_front_filter' => __( 'Pages', 'custom-domain' ),
        'contexts'                 => array( 'activity', 'member' ),
        'activity_comment'         => true,
        'bp_activity_new_post'     => __( '%1$s - <a href="%2$s">News: [title]</a>', 'custom-textdomain' ),
        'bp_activity_new_post_ms'  => __( '%1$s - <a href="%2$s">News: [title]</a>, on the site %3$s', 'custom-textdomain' ),
        'position'                 => 100,
    ) );
}
add_action( 'bp_init', 'customize_page_tracking_args' );

Within this line of code I can see that %1$s is the user name and %2$s is the post link. Are there more of these snippets within BuddyPress that I can use, specifically one for the post title?

Read More
'bp_activity_new_post'     => __( '%1$s - <a href="%2$s">News: [title]</a>', 'custom-textdomain' ),

Thanks for the help!

Related posts

1 comment

  1. You can read this Codex page on BuddyPress.org site. It has more information, and describes how to tighten the connection between CPT and BuddyPress activity feed. Here is the example.

Comments are closed.