Skip to content

Commit

Permalink
Apply author name to blog posts
Browse files Browse the repository at this point in the history
  • Loading branch information
wilson1000 committed Oct 31, 2024
1 parent e472bce commit 75dc720
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
$thumbnail = get_the_post_thumbnail_url($id, 'user-thumb');
$thumbnail_alt = get_post_meta(get_post_thumbnail_id($id), '_wp_attachment_image_alt', true);

// TODO: Why is this here? It's not used.
// If it should be here, make sure to update `Search->mapPostResult()`
$oAuthor = new Authors();
$authors = $oAuthor->getAuthorInfo($id);

$author = $post->post_author;
$author_display_name = $author ? get_the_author_meta('display_name', $author) : '';
$author = $authors[0] ?? false;
$author_display_name = $author['name'] ?? false;
$thumbnail = get_the_post_thumbnail_url($id, 'user-thumb');
$thumbnail_alt = get_post_meta(get_post_thumbnail_id($id), '_wp_attachment_image_alt', true);


if (!$thumbnail) {
// Mutate thumbnail with author image.
$thumbnail = $author ? get_the_author_meta('thumbnail_avatar', $author) : false;
$thumbnail = $author['thumbnail_url'] ?? false;
$thumbnail_alt = $author_display_name;
}

Expand Down

0 comments on commit 75dc720

Please sign in to comment.