WordPress Tricks: A simple shortcode which will output the site title

Here is a very simple way to create a shortcode that will output your WordPress site’s title.

Copy and paste this snippet into your active theme’s functions.php file:

function site_title_shortcode() {
	 $blog_title = get_bloginfo('name');
	return $blog_title;
}
add_shortcode('site_title', 'site_title_shortcode');

Now you can easily output the current site title anywhere in your content using the shortcode [site_title]