HowTo – Using WordPress Internal Settings In Theme Designs

Filed under: Wordpress Tips

wordpress-logoWhen you are designing your themes you should follow a method of calling files that will not require editing by your end user.

Every server install is different and with the bloginfo() settings call you can pull back a lot of information about your wordpress install and your theme.

Using the calls in your header.php you can point to your CSS file, describe the encoding for browsers and get quick links to your RSS feeds and directory locations.

In this way you do not need to hardcode structures and your theme users will have a better install experience.

The following calls can be made to bloginfo(callselection )

Call = Example Output

admin_email = admin@example
atom_url = http://example/home/feed/atom
charset = UTF-8
comments_atom_url = http://example/home/comments/feed/atom
comments_rss2_url = http://example/home/comments/feed
description = Just another WordPress blog
url = http://example/home
html_type = text/html
language = en-US
name = Testpilot
pingback_url = http://example/home/wp/xmlrpc.php
rdf_url = http://example/home/feed/rdf
rss2_url = http://example/home/feed
rss_url = http://example/home/feed/rss
siteurl = http://example/home
stylesheet_directory = http://example/home/wp/wp-content/themes/largo
stylesheet_url = http://example/home/wp/wp-content/themes/largo/style.css
template_directory = http://example/home/wp/wp-content/themes/largo
template_url = http://example/home/wp/wp-content/themes/largo
text_direction = ltr
version = 2.8
wpurl = http://example/home/wp

The most important for designers would be

siteurl
template_directory
stylesheet_directory

This will allow you to call files including images you may place in an image directory inside your theme folder

<img src=”<?php bloginfo(template_directory) ?>/images/image.jpg”>

wpurl may be used by plugin developers

By using this technique you can reduce your programming efforts and provide themes and code that will deploy easily for you and your users.