I wonder if anyone can help me, I am trying to display excerpt and thumbnail for the posts shown in the buddypress blog directory page. By default only avatar thumb and title link to the posts are shown.

I have created a function based on the function bp_blog_latest_post() used in the blogs loop but I am not sure how to proceed. I can see that the blog template class is accessed but don't know how to access further information, if this is not possible then do I need to use the buddypress excerpt filter as well? Here is the slightly customised function so far..


function bp_blog_latest_post_excerpt() {
    echo bp_get_blog_latest_post_excerpt();

function bp_get_blog_latest_post_excerpt() {

    //global variable carying data used in blog templae
    global $blogs_template;
    //if no posts then return nothing (and default to message I assume)
    if (null == $blogs_template->blog->latest_post)
        return false;
return apply_filters( 'bp_get_blog_latest_post', apply_filters( 'the_excerpt', $blogs_template->blog->latest_post->post_excerpt) );

closed as off-topic by fuxia Aug 2 '14 at 20:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.


I don't have a complete answer for you. But I can point out that you should use the filter hook provided in the function bp_blog_latest_post()

So something like:

add_filter('bp_get_blog_latest_post', 'your_function', 1);
function your_function(  ) { 
   global $blogs_template;

   $str = // build your string to include excerpt and thumbnail

   return $str;

I don't recall if bp_blog_latest_post() is called anywhere other than the blog directory page - if it is, then this approach will change that too.

Not the answer you're looking for? Browse other questions tagged or ask your own question.