Skip to content

Commit d38bf60

Browse files
authored
add site logo support to blog user (#400)
1 parent 9e73081 commit d38bf60

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

includes/model/class-blog-user.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,21 @@ public function get_preferred_username() {
125125
* @return array|null The User-Icon.
126126
*/
127127
public function get_icon() {
128-
$image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ) );
129-
130-
if ( $image ) {
131-
return array(
132-
'type' => 'Image',
133-
'url' => esc_url( $image[0] ),
134-
);
128+
// try site icon first
129+
$icon_id = get_option( 'site_icon' );
130+
// try custom logo second
131+
if ( ! $icon_id ) {
132+
$icon_id = get_theme_mod( 'custom_logo' );
133+
}
134+
if ( ! $icon_id ) {
135+
return null;
135136
}
136137

137-
return null;
138+
$image = wp_get_attachment_image_src( $icon_id, 'full' );
139+
return array(
140+
'type' => 'Image',
141+
'url' => esc_url( $image[0] ),
142+
);
138143
}
139144

140145
/**

0 commit comments

Comments
 (0)