Skip to:
Content
Pages
Categories
Search
Top
Bottom

Blog post images in activity stream (entry.php)


  • floris
    Participant

    @floris

    I’m pulling my hair out.

    And.

    I’m trying to tweak the way post images are displayed (and linked) in the activity stream. The secondary_item_id and the bp_blogs_record_activity seem to be relevant, but I’m unsure how to use these to get the post parent id…

    In entry.php I was thinking of adding something like:

    if ( $attachments = get_posts( array(
    'numberposts' => 1,
    'orderby' => 'menu_order ID',
    'post_mime_type' => 'image',
    'post_parent' => somethingsomething,
    'post_status' => null,
    'post_type' => 'attachment',
    ) ) ) {
    foreach ( $attachments as $attachment ) {
    $link = get_permalink( $attachment->post_parent );
    $source = wp_get_attachment_image_src( $attachment->ID, 'medium' );
    echo '<a href="' . $link . '"><img src="' . $source[0] . '" /></a>';
    }
    }

    Especially interested in a solution for the somethingsomething bit. Is it possible?

  • The topic ‘Blog post images in activity stream (entry.php)’ is closed to new replies.
Skip to toolbar