WordPress Themes: Finishing Your Custom Theme
Tutorial navigation:
Starting Your Custom Theme
Creating the Loop
Creating the Footer
Creating the Sidebar
Adding Comments
Finishing Your Custom Theme
Now that you have all your peices, lets put them together! Open index.php this is the place where we will put our "get" script that will pull the pieces together. Remember that our pieces are like building blocks or puzzle pieces? This is where it will make sence.
First we start with our header, add this tag first:
<?php get_header(); ?>
Now add your loop and sidebar. If you are familiar with divs this is where you might want to surround the loop and sidebar in thier own divs and give them styling for width etc and make sure to add that to your style.css again. The order you place your sidebar.php and theloop.php will determine what side the sidebar appears on. Place it first to appear on the left, place it second to place on the right. The code to grab these:
<?php include (TEMPLATEPATH . ‘/theloop.php’); ?>
<?php get_sidebar(); ?>
Now add your comments. This actually asks for your comment template which we didn’t create. It wasn’t necessary to get into that because it will just pull the plain theme for comments from the default theme.
<?php comments_template(); ?>
Now add your footer:
<?php get_footer(); ?>
Here is an example of a index file using 2 divs to control the style and position of the loop and sidebar (as specified in the css file):
<?php get_header(); ?>
<div id="loop">
<?php include (TEMPLATEPATH . ‘/theloop.php’); ?>
</div><div id="sidebar">
<?php get_sidebar(); ?>
</div>
<?php comments_template(); ?>
<?php get_footer(); ?>
Save your index.php file. You are all set to upload your theme! All your files should be a folder with the same name as your theme. Open up your FTP program and drop the entire folder into wp-content>themes Now your theme will show up in teh administrator panel! Congratulations, you just created your first WordPress theme!
Did this tutorial help you? Let me know, I’d love to see your finished blog themes.
1 Comment »
|
[...] Tutorial navigation: Starting Your Custom Theme Creating the Loop Creating the Footer Creating the Sidebar Adding Comments Finishing Your Custom Theme [...] |
|
| Pingback by Web Savvy Mama — February 27, 2007 @ 8:07 pm | |
RSS feed for comments on this post. TrackBack URL
Leave a comment
| You must be logged in to post a comment, |
| or you may log in using Facebook connect. |


