Tagged: activity, buddypress, CPT
- InactiveLevel: EnlightenedPosts: 28
Please is there a way I can display a custom post type in buddypress or can give me a snippet that’s can display WooCommerce product in activity stream
Hello Adeala,
Thank you for posting. Try the following code which enables WooCommerce product post type to be recordable.
add_filter( 'bp_blogs_record_post_post_types', function ( $post_types ) { if ( ! function_exists( 'WC' ) ) { return $post_types; } if ( is_array( $post_types ) && ! in_array( 'product', $post_types ) ) { $post_types[] = 'product'; } return $post_types; } );
Please let me know if it works or not.
Regards
RaviDoes this work for other CPTs too?
I created a custom post type using Toolset Types and I would like to add a message to the activity stream each time a user creates a post or comments to someone else’s post.
I tried several solutions but with no luck so far.Any help much appreciated!
Hello Hugo,
Thank you for asking. Try the following code for CPT
add_filter( 'bp_blogs_record_post_post_types', function ( $post_types ) { // Replace movie with your post type. $post_type = get_post_type_object( 'movie' ); if ( ! $post_type || ! $post_type->public || in_array( 'movie', $post_types ) ) { return $post_types; } $post_types[] = 'movie'; return $post_types; } );
Please do let me know if it works or not.
Regards
RaviThanks Ravi.
I added this code to my bp-custom.php and also tried functions.php. I tried with the singular name and with the slug, but no success so far. Any ideas?
Hi Ravi,
Which plugin are you talking about? In my case it is about a cpt created by a third party plugin.
FYI I am using the Community builder Pro theme.- This reply was modified 3 years, 8 months ago by Hugo Callens.
Hi Ravi, Hugo,
The activity recording has nothing to do with the theme. If it works for any theme, It will work with the Community Builder pro too.
Please check that it works properly.
Regards
Brajesh
You must be logged in to reply to this topic.