Activity

  • Milena replied to the topic Activity Wall – Show Featured image like Facebook in the forum Requests and Feedback 9 years, 6 months ago

    Hi @rotju,

    I figured it out.

    last step, add this code to custom.css

    #buddypress div.activity-comments div.acomment-content img {
    display: none;
    }

    so just to recap the steps:
    1. add the function to display the featured image inside the post to content.php
    <?php if ( has_post_thumbnail() ) : ?>
    <a class="entry-post-thumbnail" href="<?php the_permalink(); ?>">
    <?php the_post_thumbnail('full'); ?>
    </a>
    <?php endif; ?>

    right after this part
    </div><!– .entry-meta –>`

    2. add your code to functions.php-

    function icondeposit_bp_activity_entry_meta() {

    if ( bp_get_activity_object_name() == 'blogs' && bp_get_activity_type() == 'new_blog_post' ) {?>
    <?php
    global $wpdb, $post, $bp;
    $theimg = wp_get_attachment_image_src( get_post_thumbnail_id( bp_get_activity_secondary_item_id() ) );
    ?>
    <img src="<?php echo $theimg[0]; ? />" >

    <?php }

    }
    add_action('bp_activity_excerpt_append_text', 'icondeposit_bp_activity_entry_meta');

    3. add this css to custom.css

    .activity-list .activity-content img.thumbnail {display:none;}
    #buddypress div.activity-comments div.acomment-content img {
    display: none;
    }

    4. hope for the best.
    🙂

    let me know if that works out for you.