这已经困扰了我很多年了,不能让它正常工作。我在我的函数文件中使用以下代码来显示由同一作者创建的帖子和当前的单个帖子。
function get_related_author_posts() {
global $authordata, $post;
$authors_posts = get_posts( array( \'author\' => $authordata->ID, \'post__not_in\' => array( $post->ID ), \'posts_per_page\' => 1, \'post_type\' => \'artistblog\' ) );
foreach ( $authors_posts as $authors_post ) {
$output .= \'<div class="artist-blog-thumb"><a href="\' . get_permalink( $authors_post->ID ) . \'">\'. get_the_post_thumbnail( $authors_post->ID,\'medium\' ) .\'</a></div><h3><a href="\' . get_permalink( $authors_post->ID ) . \'">\' . apply_filters( \'the_title\', $authors_post->post_title, $authors_post->ID ) . \'</a></h3>\';
}
return $output;
}
这很有效。然而,我还想为每篇文章显示自动修剪的摘录。我尝试过各种方法,但没有一种效果很好。有人能帮忙吗?