WordPress Templating – Part 1

Oks recently I’ve been playing around with the WordPress Templating system as of late and working on one for this site which hopefully soon I have to up and running. But I discovered a few things here and there and I thought it would be good to share with everyone who’s starting to use WordPress but not sure about it really. Well Im going to do my best in explaining how the templating system for WordPress works.

What is it?

WordPress is a Content Management System (CMS), to put it simply all the stuff you write up, manages it so you dont have make new files for every blog post you do. It has tons of features, which can be found at WordPress.org They also have what they call a Codex, though its awesome documentation its a bit confusing to go through.

Structure

When you install WordPress it comes with a nice lil handy template for you to use in the beginning. But lets talk about the structure for WordPress….

/

/wp-admin
/wp-content

/plugins
/themes

/twentyten

/images
/languages
404.php
archive.php
attachment.php
author.php
category.php
comments.php
editor-style.css
editor-style-rtl.css
footer.php
functions.php
header.php
index.php
license.txt
loop-attachment.php
loop-page.php
loop.php
loop-single.php
onecolumn-page.php
page.php
rtl.css
screenshot.png
search.php
sidebar-footer.php
sidebar.php
single.php
style.css
tag.php

/uploads
index.php

/wp-includes
index.php
license.txt
readme.html
robots.txt
wp-activate.php
wp-app.php
wp-atom.php
wp-blog-header.php
wp-comments-post.php
wp-commentsrss2.php
wp-config.php
wp-config-sample.php
wp-cron.php
wp-feed.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-pass.php
wp-rdf.php
wp-register.php
wp-rss2.php
wp-rss.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php

As you can see the main area that we need to focus on is /wp-includes/themes . You can easily search the web and find lots of themes already made. Ill admit when first starting this site I didnt know too much about WordPress so making a theme would of been a hassle. I found something nice and got it installed just to get things going. But I had the opportunity to get to play with this more so I feel confident enough in explaining it to others.

What to focus on

There are a few partcular files to focus on when making your own theme:

  • 404.php
  • category.php
  • footer.php
  • functions.php
  • header.php
  • index.php
  • loop-page.php
  • loop.php
  • loop-single.php
  • page.php
  • single.php
  • style.css

I know there are a lot of files to be looking at but trust me its not as bad as it seems. The worst of it is when it comes to the functions. I’ll do my best to explain what they do and how to use them. Plus a few things can be skinned as well, so we’ll get into that. Prepare for quiet a few posts.

What each file is for

index.php

This is the basic page that you’ll always run into where it will generally pull up, as the first page you would see.

header.php

Its always good to keep that separate because generally you’ll always have that same info for every single page that will be pulled up. You know meta tags, css sheets, any javascripts, things like that.

footer.php

Just like the header, this is for the bottom of the page, say who made it, contact info, anything you really would want to put onto here its your choice

page.php

Every time you make a page it will be formatted in this particular way. Most people would want a distinct look between a page and a blog post, but doesnt have to be the case, can make them look the same, or be different, or just use the default formatting.

post.php

I know there isnts a post.php in the orginal list but you can honestly write this and override the way the posts are written out

style.css

This is the file that of course will style your website. Im pretty sure Ill write out an article on how to customize the look of your site

I know I didnt go into details about every single one, Im trying not to overload too much info into one post here.

Be on the look out for other posts!