我想知道是否有人可以帮助我,我正在尝试显示buddypress博客目录页面中显示的帖子的摘录和缩略图。默认情况下,只显示指向帖子的头像拇指和标题链接。
我基于函数创建了一个函数bp_blog_latest_post()
在博客循环中使用,但我不确定如何继续。我可以看到blog模板类已被访问,但不知道如何访问更多信息,如果无法访问,那么我是否还需要使用buddypress摘录过滤器?这是迄今为止略微定制的功能。。
<?php
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;
//otherwise..
return apply_filters( \'bp_get_blog_latest_post\', apply_filters( \'the_excerpt\', $blogs_template->blog->latest_post->post_excerpt) );
}
?>