diff --git a/author.php b/author.php index c1abdf757d..8397c618fc 100755 --- a/author.php +++ b/author.php @@ -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' => $context['default_avatar']]), 'width' => '300', 'height' => '300', ]; diff --git a/images/p4-avatar.jpg b/images/p4-avatar.jpg new file mode 100644 index 0000000000..24e6ff6e1c Binary files /dev/null and b/images/p4-avatar.jpg differ diff --git a/src/MasterSite.php b/src/MasterSite.php index 37b991320a..81c78dc84b 100644 --- a/src/MasterSite.php +++ b/src/MasterSite.php @@ -762,6 +762,14 @@ function ($item) { // IA: Tabs menu on mobile. $context['mobile_tabs_menu'] = (bool) planet4_get_option('new_ia'); + // Default avatar. + if (defined('WP_DEBUG') && WP_DEBUG === true) { + // Gravatar throws an error for local dev default_avatar URL, so the default value is used. + $context['default_avatar'] = 'mm'; //Mystery Man + } else { + $context['default_avatar'] = get_template_directory_uri() . '/images/p4-avatar.jpg'; + } + return $context; } diff --git a/templates/author.twig b/templates/author.twig index f203053c36..b2af9b03ab 100644 --- a/templates/author.twig +++ b/templates/author.twig @@ -5,7 +5,7 @@ {% if ( author.avatar ) %}
{{ author.name }}
{% endif %} diff --git a/templates/blocks/author_profile.twig b/templates/blocks/author_profile.twig index c819761b8a..b8f6ff99f8 100644 --- a/templates/blocks/author_profile.twig +++ b/templates/blocks/author_profile.twig @@ -5,7 +5,7 @@
{{ post.author.name }}
@@ -16,7 +16,7 @@
{{ post.author.name }}
diff --git a/templates/single.twig b/templates/single.twig index fe1f62adff..5a5d992ef7 100644 --- a/templates/single.twig +++ b/templates/single.twig @@ -48,7 +48,7 @@
{% if not post.get_author_override and post.author.avatar %} {{ post.author.avatar }} {% endif %}