Я пытаюсь отобразить все сообщения одного автора в шаблоне single-author.php. В файле functions.php я пытаюсь назвать заголовок и постоянную ссылку. Однако я не могу добавить пост-функцию изображения в вывод. Любые идеи будут полезны. Здесь приведен код functions.php.
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' => 8 ) );
$output = '<ul>';
foreach ( $authors_posts as $authors_post ) {
$url = wp_get_attachment_url( get_post_thumbnail_id($authors_posts->ID) );
$output .= '<li style="background: url('. $url.')"><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title,$authors_post->image, $authors_post->ID ) . '</a></li>';
}
$output .= '</ul>';
return $output;
}