Skip to content

Commit

Permalink
[ G3 ][ Bug fix ] Fix profile image warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kurudrive committed Dec 6, 2024
1 parent a6008a4 commit 98c07b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
20 changes: 12 additions & 8 deletions _g3/inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,18 +355,22 @@ function lightning_get_entry_meta( $options = array() ) {
<span class="vcard author" itemprop="author">';

if ( $option['author_image'] ) {
$html .= '<span class="entry-meta-item-author-image">';

// VK Post Author Display の画像を取得.
$profile_image_id = get_the_author_meta( 'user_profile_image' );
if ( $profile_image_id ) {
$profile_image_src = wp_get_attachment_image_src( $profile_image_id, 'thumbnail' );
$html .= '<img src="' . $profile_image_src[0] . '" alt="' . esc_attr( $author ) . '" />';
$profile_image_id = get_the_author_meta( 'user_profile_image' );
$vk_post_author_display_image_src = wp_get_attachment_image_src( $profile_image_id, 'thumbnail' );
// 画像がメディアライブラリ側で削除されたりもするため、 is_array で判定.
if ( is_array( $vk_post_author_display_image_src ) ) {
$profile_image = '<img src="' . $vk_post_author_display_image_src[0] . '" alt="' . esc_attr( $author ) . '" />';
} else {
$html .= get_avatar( get_the_author_meta( 'email' ), 30 );
// プロフィール画像がない場合は Gravatar.
$profile_image = get_avatar( get_the_author_meta( 'email' ), 30 );
}

$html .= '</span>';
if ( $profile_image ) {
$html .= '<span class="entry-meta-item-author-image">';
$html .= $profile_image;
$html .= '</span>';
}
}

if ( $option['author_name'] ) {
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ https://www.vektor-inc.co.jp/inquiry/

== Changelog ==

[ G3 ][ Bug fix ] Fix profile image warning
[ G2 ][ Specification Change ] Change load module priority

v15.28.2
Expand Down

0 comments on commit 98c07b7

Please sign in to comment.