Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add woocommerce product image in activity stream


  • aqeeliqbal
    Participant

    @aqeeliqbal

    Hi,
    I have added the custom post type “product” (woocommerce product) using below code. But not product image show in activity stream like blog post featured image. Is there any way to show custom post type image in activity stream?

    add_post_type_support( 'product', 'buddypress-activity' );
    function customize_product_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( 'product', array(
            
            'action_id'                => 'new_product',
            'bp_activity_admin_filter' => __( 'Published a new product', 'custom-domain' ),
            'bp_activity_front_filter' => __( 'Products', 'boss' ),
            'contexts'                 => array( 'activity', 'member' ),
            'activity_comment'         => true,
            'bp_activity_new_post'     => __( '%1$s posted a new <a href="%2$s">product</a>', 'boss' ),
            'bp_activity_new_post_ms'  => __( '%1$s posted a new <a href="%2$s">product</a>, on the site %3$s', 'boss' ),
            'position'                 => 100,
        ) );
    }
    add_action( 'bp_init', 'customize_product_tracking_args' );
Viewing 2 replies - 1 through 2 (of 2 total)

  • aqeeliqbal
    Participant

    @aqeeliqbal

    @shanebp kindly help me as you do that in following post
    custom post type – activity stream thumbnail


    dalipekez
    Participant

    @dalipekez

    you can use like that,for me its working- but downside is all new products will be associated as posts in the activity stream. Can you tell me if you have also issue if somebody comments on activity stream at your posted product or any other activity, that notification you will get then click on it it will redirect you to activity of user who posted but not the actual conversation?

    anyway.. here is the function i use in php function

    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[] = ‘product’;
    return $post_types;
    }

    let me know if it works

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar