astra_author_avatar( string $get_for = 'single-post' )

Function to get Author Avatar.


Description


Parameters

$get_for

(string) (Optional) Get for.

Default value: 'single-post'


Return

(mixed) $avatar Author Avatar.


Source

File: inc/blog/blog-config.php

function astra_author_avatar( $get_for = 'single-post' ) {
	$avatar = '';
	if ( is_singular() ) {
		if ( 'single-post' === $get_for && astra_get_option( 'ast-dynamic-single-' . strval( get_post_type() ) . '-author-avatar', false ) ) {
			$avatar_image_size = astra_get_option( 'ast-dynamic-single-' . strval( get_post_type() ) . '-author-avatar-size', 30 );
			$avatar            = '<span class="ast-author-avatar">' . strval( get_avatar( astra_get_author_id(), $avatar_image_size ) ) . '</span>';
		} elseif ( 'related-post' === $get_for && astra_get_option( 'related-posts-author-avatar', false ) ) {
			$avatar_image_size = astra_get_option( 'related-posts-author-avatar-size', 30 );
			$avatar            = '<span class="ast-author-avatar">' . strval( get_avatar( astra_get_author_id(), $avatar_image_size ) ) . '</span>';
		} else {
			$avatar = '';
		}
	}
	return $avatar;
}

Changelog

Changelog
Version Description
4.6.0 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.