Print Friendly

Featured Image


None at this time

Show Extras

Now that I have described the concept of the WordPress file structure it is time to make a few files to get the site started. We will first make the basic files to get a blog running. Keep in mind you will have to do lots of research to get the advanced features of your site working. The process of finalizing your site can be never-ending. I find myself always tweaking my CSS file and know that it will change almost daily. But if you weren’t up for that challenge then you wouldn’t have gotten this far in creating a custom theme. You would have already downloaded a theme template and had your site up and running. So for now let’s get our basic files created and the theme working so that we can get back to the overall mission of this tutorial of merging WordPress and Zenphoto.

Once again I am using Textwrangler and will refer to that as my text editor during this post. Have Textwrangler open and start your local server with MAMP.

1. Theme Folder

Create a folder for the Theme files in Finder or, if using Windows, Explorer. This folder should be in your local server and in: server\wordpress\wp-content\themes\Mytheme

Note: You can choose any name for the folder, I used Mytheme as an example.

2. Files

Open Textwrangler and create these basic files:

  • header.php
  • index.php
  • sidebar.php
  • footer.php
  • functions.php
  • style.css

To do this, simply go to File, then New, and then Save As the names above. You should now have the six basic files.

3. style.css

Now in the style.css file add the following code to the top of the file. describes this style header here. Make sure you include the CSS comments, or the /* and */, to comment out this section. Otherwise your browser will think this is CSS code and get confused. Replace all the information with your specific names and URLs. When done save all your work. What this code does is identify the theme so WordPress will recognize it and let you activate it. As mentioned above I am using Mytheme as the example name.

4. header.php

Now we need to setup the basic HTML that will form each page. The first section of code is our header. In you header.php file paste the following code.

Note: make sure to keep the comment code next to the close of the DIV. This will help you identify specific DIVs when editing each file.

5. footer.php

Copy and Paste the following code into your footer.php file. If you have referenced Ian Stewart’s tutorial then you will recognize that I am doing the footer a little different. I am placing my footer outside the wrapper. If you want the footer to be the same width and be in line with everything else on the page then I suggest doing it the same way Ian has in his tutorial. I did mine a little different because I wanted the footer to have the freedom do be as wide as the content I wish to put into it.

6. sidebar.php

Copy and Paste the following code into your sidebar.php file.

7. index.php

Copy then Paste the following code into your index.php file. Notice the php get_ code. What this does is get the code from the header.php and loads that before loading the rest of the code. It then does the same for the sidebar.php and footer.php at the end of the file. This is how all the files come together as one when a single page is loaded. In essence the header.php, footer.php, and sidebar.php files are like code storage files and the page, or index.php, file retrieves the code from each and builds the specific page dynamically.

Here is an example of what this will all look like when it comes together to form a single WordPress page. It builds a regular HTML file.

Visually it should be very similar to the image from the last post.

8. Activate Theme

This step could be done at any time, but now might be a good point so you can see what you’ve created. Of course at the moment there is no content and everything is blank, however the files are there. Login to your WordPress installation via your web browser.

Once in your Dashboard select Appearance > Themes on the left column. You should see your theme listed here. In my case it is called Mytheme. Select Activate and your perfectly blank theme is ready to go. If you view your site the only way to tell you have anything there would be to right click and select “View Page Source”.


Your basic WordPress theme files are now structured. The next step is to write code so that the structure we just created is filled with content. I know this might seem like a silly point to stop this post, but trust me you’ll be happy in the end that I broke it down this way. The next step is a lot to absorb, so be ready!

For more insite on WordPress and blogs check out’s description of a Blog. This might help guide you with the direction of your website.

Series Navigation<< WordPress Site Design – WordPress LayoutWordPress Site Design – Functions and Loops >>

Post a Comment

Your email is never published nor shared. Required fields are marked *


Copyright © 2013 All rights reserved. | Site design by Daniel J. Eckes | Privacy