Aug 8, 2012

Wordpress Bloginfo Shortcode

A small snippet for Wordpress Bloginfo. This will help you to add images directly without giving the entire path. Its a shortcode snippet

[php]
function get_bloginfo_shortcode( $atts ) {
extract(shortcode_atts(array(
'info' => '',
), $atts));
return get_bloginfo($info);
}
add_shortcode('bloginfo', 'get_bloginfo_shortcode');
[/php]

Usage :

[html]
<img src="[bloginfo info='template_url']/images/logo.jpg" alt="[bloginfo info='name'] logo" />
[/html]

Now you can easily call your images without giving actual path.

Credits Forrst

No comments :

Post a Comment