X

Display bloginfo using shortcode

AdSanity review - group

Adding this snippet to the functions.php of your wordpress theme will let you call bloginfo parameters using shortcode. Bellow is also a list of parameters that can be use with the shortcode. This little snippet has come in handy with a few projects I have worked on.


function bloginfoSC( $atts ) {
             extract(shortcode_atts(array(       'value' => '',   ), $atts));
             return get_bloginfo($value);
}

add_shortcode('bloginfo', 'bloginfoSC');
[bloginfo value='name']
[bloginfo value='url']
[bloginfo value='description']
[bloginfo value='charset']
name                 = Blog name
description          = Blog description
admin_email          = admin@email.com
url                  = http://example/home
wpurl                = http://example/home/wp
stylesheet_directory = http://example/home/wp/wp-content/themes/child-theme
stylesheet_url       = http://example/home/wp/wp-content/themes/child-theme/style.css
template_directory   = http://example/home/wp/wp-content/themes/parent-theme
template_url         = http://example/home/wp/wp-content/themes/parent-theme
atom_url             = http://example/home/feed/atom
rss2_url             = http://example/home/feed
rss_url              = http://example/home/feed/rss
pingback_url         = http://example/home/wp/xmlrpc.php
rdf_url              = http://example/home/feed/rdf
comments_atom_url    = http://example/home/comments/feed/atom
comments_rss2_url    = http://example/home/comments/feed
charset              = UTF-8
html_type            = text/html
language             = en-US
text_direction       = ltr
version              = 3.1

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!