Mai Avatar [mai_avatar] Shortcode
Our Mai Avatar shortcode allows you to display a post author’s avatar in your header or footer meta, inside your content, template parts, or anywhere shortcodes can be used.
The example below adds the [mai_avatar]
shortcode to the Header Meta text field in Customizer > Theme Settings > Single Content > Post.
Here is an overview of how to use shortcodes.
Here are the available parameters to custom your avatar display.
id
Theidof which user avatar to display.
Use current
to show the post/page’s author avatar.
Use user
to show the currently logged in user’s avatar.
Use any user ID to show that specific user’s avatar.
Examples:
[mai_avatar]
This is the same as the first example and displays the current author avatar:
[mai_avatar id="current"]
This displays the currently logged in user’s avatar.
[mai_avatar id="user"]
This displays an avatar for the user with an id of 1234:
[mai_menu id="1234"]
size
The size to display the avatar. Accepts any unit value (px, em, rem, %, etc).
Examples:
[mai_avatar size="40px"]
display
Accepts any CSS display property. This is typically not used.
Examples:
[mai_avatar display="inline"] [mai_avatar display="inline-flex"]
margin_top
Adds top margin to the avatar. Accepts any unit value (px, em, rem, %, etc).
[mai_avatar margin_top="8px"]
margin_bottom
Adds bottom margin to the avatar. Accepts any unit value (px, em, rem, %, etc).
margin_left
Adds left margin to the avatar. Accepts any unit value (px, em, rem, %, etc).
margin_right
Adds right margin to the avatar. Accepts any unit value (px, em, rem, %, etc).