Below, you’ll find a detailed guide on how to add the Author Image Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Author Image Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the Author Image Plugin and the shortcodes it provides:
"Author Image is a WordPress plugin designed to enhance your posts by allowing you to easily add, customize, and manage author images across your website. Ideal for blogs and multi-author platforms."
- [author-image]
Author Image [author-image] Shortcode
The ‘author-image’ shortcode from the sem-author-image plugin is used to display the image of the author. It calls the function ‘shortcode_callback’ which in turn invokes ‘the_author_image()’.
Shortcode: [author-image]
Examples and Usage
Basic example – Display the author’s image using the ‘author-image’ shortcode without any parameters.
[author-image /]
Advanced examples
Display the author’s image with a specific size. In this case, we are using the ‘size’ parameter to specify the image size. The value of ‘size’ can be either a string keyword (thumbnail, medium, large or full), or a 2-item array representing width and height in pixels, respectively.
[author-image size="medium" /]
Display the author’s image with a specific alignment. Here, we are using the ‘align’ parameter to specify the image alignment. The value of ‘align’ can be either ‘left’, ‘center’, or ‘right’.
[author-image align="center" /]
Display the author’s image with a custom CSS class. In this example, we are using the ‘class’ parameter to add a custom CSS class to the image.
[author-image class="custom-class" /]
Combining multiple parameters. You can also combine multiple parameters to customize the author’s image display as per your requirements. In this case, we are specifying both the size and alignment of the image.
[author-image size="large" align="left" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [author-image]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'author-image', 'shortcode_callback' );
Shortcode PHP function:
function shortcode_callback() {
the_author_image();
}
Code file location:
sem-author-image/sem-author-image/sem-author-image.php
Conclusion
Now that you’ve learned how to embed the Author Image Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply