Skip to content

Commit

Permalink
PLANET-7646 Add placeholder image to Author block
Browse files Browse the repository at this point in the history
if author image is not available show MistryPerson(mm) avatar image
  • Loading branch information
sagarsdeshmukh committed Dec 26, 2024
1 parent f150767 commit 4d46380
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion author.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$context['og_title'] = $author->name;
$context['og_description'] = get_the_author_meta('description', $author->ID);
$context['og_image_data'] = [
'url' => get_avatar_url($author->ID, [ 'size' => 300 ]),
'url' => get_avatar_url($author->ID, [ 'size' => 300, 'default' => 'mm']),
'width' => '300',
'height' => '300',
];
Expand Down
2 changes: 1 addition & 1 deletion templates/author.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% if ( author.avatar ) %}
<figure class="author-image" aria-label="{{ __( 'Picture of ' ~ author.name , 'planet4-master-theme' ) }}">
<img itemprop="image" class="author-pic"
src="{{ fn('get_avatar_url', author.id, {'size' : 300}) | replace({'=s96-c':""}) }}"
src="{{ fn('get_avatar_url', author.id, {'size' : 300, 'default': 'mm'}) | replace({'=s96-c':""}) }}"
alt="{{ author.name }}">
</figure>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions templates/blocks/author_profile.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<figure class="author-block-image d-none d-sm-none d-md-block">
<img
itemprop="image"
src="{{ fn('get_avatar_url', post.author.id, {'size' : 294 }) | replace({'=s96-c':""}) }}"
src="{{ fn('get_avatar_url', post.author.id, {'size' : 294, 'default': 'mm'}) | replace({'=s96-c':""}) }}"
alt="{{ post.author.name }}"
/>
</figure>
Expand All @@ -16,7 +16,7 @@
<figure class="author-block-image d-block d-sm-block d-md-none">
<img
itemprop="image"
src="{{ fn('get_avatar_url', post.author.id, {'size' : 294 }) | replace({'=s96-c':""}) }}"
src="{{ fn('get_avatar_url', post.author.id, {'size' : 294, 'default': 'mm'}) | replace({'=s96-c':""}) }}"
alt="{{ post.author.name }}"
/>
</figure>
Expand Down

0 comments on commit 4d46380

Please sign in to comment.