Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity Stream – for new posts only show the featured image and excerpt


  • tommybaz
    Participant

    @tommybaz

    Hi all,

    New to BP & WP in general, using WP v4.4.2 and BP v2.5.1.

    I am trying to tidy up my activity stream and I’m searching for some advice on how to change how new posts display in the activity stream.

    I created a CPT: “business” and added the support for buddypress-activity and added a filter into bp-custom.php to include the posts featured image. So, when i add a new business post it displays the first ~350 characters of the post (with all of the html formatting removed), and then the featured image.

    Instead of this I only want to display (in this order):


    – The post’s featured image (linked to the post);
    – The post’s custom excerpt (the_excerpt();)

    I want to remove the post’s main content completely from these new activity updates, as it just looks a mess.

    Firstly, is this possible?
    Secondly, can anyone help me achieve this?

    I appreciate any help 🙂

    Tommy

Viewing 1 replies (of 1 total)

  • tommybaz
    Participant

    @tommybaz

    Just in case it matters i have used this code in my bp-custom.php to add the featured image to activity stream:

    <?php
    
    function record_cpt_activity_content_featured_image( $cpt ) {
    
        if ( 'new_business' === $cpt['type'] ) {
    
            global $wpdb, $post, $bp;
            $theimg = wp_get_attachment_image_src(  get_post_thumbnail_id( bp_get_activity_secondary_item_id() ), 'large' );
            $cpt['content'] .= '<img src="' . $theimg[0] . '">';
        }
    
        return $cpt;
    }
    add_filter('bp_before_activity_add_parse_args', 'record_cpt_activity_content_featured_image');
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar