Wordpress Theme Development

WordPress theme is merely a folder which is to be placed in wp-content folder of wordpress hierarchy .

The basic files needed in that theme folder is index.php and style.css

In this style.css the following lines are very essential.

Theme Name: Theme Namet

Theme URI: http://www.sajithmr.com/

Description: Details of your theme

Author: Author name

Author URI: http://www.sajithmr.com/

This theme was designed and built by Sajith

The CSS, XHTML and design is released under GPL


Design your theme (static page) and put this as index.php in theme folder. Go to wordpress admin panel and set the current theme as the theme you created now. Then you can see the static design created by you.

Next step is make each part dynamic. For example if you want to make your blog title dynamic , replace your static code with

wp_title(); ?>

Make your style sheet path also dynamic by : ” type=”text/css” media=”screen” />

Like this , there is a lot of built in dynamic functions in wordpress.I will give you some links at the end of this post .

Another , very special , feature of wordpress theme is its hierarchy. You can sub divide the index.php files into a lot of sub files. See the below picture

Wordpress theme hierarchy

(Click on the picture to see full size)

This picture shows the control flow whenever a particular url request arrives. For example you can write all the code for footer in footer.php and can include this file in yourindex.php file as

get_footer(); *?> *

Some important wordpress dynamic functions:

Function for showing posts:

posts()) : thepost(); ?>

See this link for further development: http://codex.wordpress.org/Theme_Development

Wordpress Theme DevelopmentWordpress Theme Development

Some useful functions:

*wp_list_categories(‘title_li=’); ?>/ Listing categories */

editpostlink(‘Edit this entry.’,”,”);* ?> / Post edit link*/

the_category() *?> */* Shows current category*/

wplistpages(‘sortcolumn=menuorder&depth=1&title_li=’);?>/* Page Links*/

wp_head(); ?> /* Head information */

wp_loginout(); ?>/* Login / logout links*/

the_permalink() ?>/* Get the permalink */

the_excerpt(); ?>/* Get the short description of a post*/

postsnavlink(‘ — ‘, _(‘« Older Posts’), _(‘Newer Posts »’)); ?> /Page navigation/