Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add Custom post type Featrued Image in Site-wide Activity?


  • vhankim
    Participant

    @vhankim

    I tried to find a way to search, but many codes did not work properly.
    Do not bring a distinctive image links.

    Where is the wrong in this code?

    
    function record_cpt_activity_content_featured_image( $cpt ) {
    
        if ( 'new_product' === $cpt['type'] ) {
    
            global $wpdb, $post, $bp;
            $theimg = wp_get_attachment_image_src(  get_post_thumbnail_id( bp_get_activity_secondary_item_id() ) );
            $cpt['content'] .= '<img src="' . $theimg[0] . '">';
        }
    
        return $cpt;
    }
    add_filter('bp_after_activity_add_parse_args', 'record_cpt_activity_content_featured_image');
    
Viewing 2 replies - 1 through 2 (of 2 total)

  • shanebp
    Moderator

    @shanebp

    Try using the filter hook in function bp_activity_content_body()
    Found in buddypress\bp-activity\bp-activity-template.php


    vhankim
    Participant

    @vhankim

    Hi @shanebp Thanks 🙂

    I have tried in your way.
    The CPT Excerpt appears very well. However, Featured image does not appear…

    Is the image loading code is the problem?

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