So I am trying to show a custom post type "Thingy" in the buddypress activity. I am using the code below which displays the activity i.e. when a new custom post type is created and also shows the string "what you need" but as you can see when I call for the get_the_ID(), it simply displays the page ID of the form I am using to publish the post, over that I am sure that the featured images are assigned properly but are not displaying as well.
here is a screenshot:
This is mainly because I am willing to display featured image, description, title and other data from the post.
Note: I have tried bp_after_activity_add_parse_args as well as bp_before_activity_add_parse_args, gives same result.
I am using buddypress 2.7.2, using pods 2.6.7 for custom post types, Gravity forms to publish the custom posts.
add_post_type_support( 'thingy', '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( 'thingy', array(
'component_id' => 'activity',
'action_id' => 'new_thingy',
'bp_activity_admin_filter' => __( 'New Thingy', 'custom-domain' ),
'bp_activity_front_filter' => __( 'Thingy', 'custom-domain' ),
'contexts' => array( 'activity', 'member' ),
'bp_activity_new_post' => __( '%1$s Posted a new <a href="%2$s">Thingy</a>', '' ),
'position' => 100,
) );
}
add_action( 'init', 'customize_page_tracking_args', 1000 );
//record new cpt and enter content for same.
function record_cpt_activity_content( $cpt ) {
if ( 'new_thingy' === $cpt['type'] ) {
$cpt['content'] = 'what you need'. get_the_ID() . the_post_thumbnail();
}
return $cpt;
}
add_filter('bp_after_activity_add_parse_args', 'record_cpt_activity_content');
I would really appreciate any help..