Part 1: generalities

Ok. So the first thing I want you to know is that wordpress works exactly like php includes or html, the only difference is that it uses functions to show the things you post from your dashboard, the comments people posted and to keep track of those things. The rest is the same. The entire code is cut into sections, but together they form a layout. For example: index.php is your center piece. Before index.php comes header.php and after it comes sidebar.php and footer.php. Or let me explain it in a different way. The first piece of coding is header.php, there is the part where everything starts, after that comes index.php (or page.php/single.php + comments.php/404.php), after that comes sidebar.php and after that comes footer.php. The whole thing is like a chain and every ring on that chain has it’s established position.

So now that we made this clear, let’s move to the container. The container is that thing that makes your whole layout to stay into one piece and always in the center of the page. And we all know it’s components:

<div id =”container”>

<div id =”header”> </div>

<div id =”sidebar”> </div>

<div id =”content”> </div>

&div id =”footer”> </div>

</div> – this is where your container closes.

I think you are familiar with this, everybody must have seen something like this at least once. So, you should know it is really important to remember that once you open a div you must close it. I think it’s the most important thing ever. Always close them, because my friends, if you leave a div open, that is what messes your wordpress theme. Why? Because many times, people tend to forget they opened a div, sometimes you ad a closing div tag before it’s time to close and boom, everything is messed up. Also, many times you open a div in one file and you have to close it in another, so it’s really confusing.

This is the reason I wanted to do this introduction. The key points of this part are:

1. Remember the order of the code and therefore the order of the files
2. Remember to ALWAYS close the div tags you open (or any other tag, because not only divs mess up with your code)

The key is to be organized. For example if I mess up my theme I just take a pen and a paper and put there all the things I opened and all the tags I closed. And I always find my mistake. You don’t have to have the eye formed for that. It’s pure math. You opened 3 divs, you have to have 3 closing tags. Simple as that.

So now I begin to explain you the pages. Please note that these are the codes in my themes, so if there are some people who have more codes on their themes or less, it’s not my fault. This is what I use. Also, before I really start explaining, I am going to put a .txt file with the coding, so that you can see the whole code and have an overall view on the file. I’m gonna skip a few lines because they are the same as in php pages.