Do you want to call bloginfo() function by using Shortcode to get the Site name, stylesheet directory, website URL, theme directory etc? Then you land on the right planet.
Here we have posted the simple code snippets that will create the Bloginfo’s shortcode. Just follow below guide and use the code.
Read also: Best Shortcodes that Every WordPress Website Need, Add a Revolution Slider without using a Shortcode or Widget
Let’s not waste time and get to the point.
Call Bloginfo using Shortcode WordPress
Below we have embedded the code that you need to put in your theme. For that: copy the below code and paste it into your WordPress theme‘s functions.php file.
Code to Create shortcode of Bloginfo
After that, we need to call bloginfo by shortcode.
For that:
We have embedded another code that will tell you the usage of that shortcode.
Code of Usage Bloginfo Shortcode
As you can see the above code we want to display the site name, so we called it by putting value “name” in the key attribute.
Just put any value, and you will get the same result as you are coding from the backend.
One Example with Usage
In the above example we displayed the logo image which is inside of our active theme folder.
That’s it.
If you guys have any error, questions or wanna say something about this post, please let us know in the comment box.
Also, do share this guide on social media sites. 😉