add site logo support to blog user (#400)

This commit is contained in:
Matt Wiebe 2023-08-16 21:39:55 -05:00 committed by GitHub
parent 9e73081668
commit d38bf60d11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,16 +125,21 @@ class Blog_User extends User {
* @return array|null The User-Icon. * @return array|null The User-Icon.
*/ */
public function get_icon() { public function get_icon() {
$image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ) ); // try site icon first
$icon_id = get_option( 'site_icon' );
if ( $image ) { // try custom logo second
return array( if ( ! $icon_id ) {
'type' => 'Image', $icon_id = get_theme_mod( 'custom_logo' );
'url' => esc_url( $image[0] ), }
); if ( ! $icon_id ) {
return null;
} }
return null; $image = wp_get_attachment_image_src( $icon_id, 'full' );
return array(
'type' => 'Image',
'url' => esc_url( $image[0] ),
);
} }
/** /**