The core files of a wordpress theme is index.php
This is the most important files in every wordpress theme. You must have this file if you create your own wordpress theme.
The index.php must contain code like this:
<?php if (have_posts()) { ?>
<?php while (have_posts()) { the_post(); ?>
// Code to show the blog content
<?php } ?>
<?php } ?>
If you know those scripts are PHP scripts, then you’ve already have a good understanding about what we talk about PHP script before. But, If you don’t understand exactly the what above code do, don’t worry you don’t have to understand it if you just want to create wordpress theme. You just need to know that it’s called “the loop“.
Simply the loop is used to display your blog post. It’s used everywhere in single post, homepage, archive, search results, tag pages, etc. The loop will automatically done it for you. For example, if you set your homepage to show 5 last posts in wordpress admin settings, the loop will automatically show 5 posts. If you want to go further, you can read the Wordpress documentation about the loop. But once again, if you just want to make wordpress theme, no need to deep understand it.
The second file is style.css
This file is used to define the themes Information that will appear in the Wordpress Admin Menu. It’s usually also used to define the Cascade Style Sheet (CSS) of a wordpress theme.
Generally, style.css looks like this:
/*
Theme Name: <your theme name>
Theme URI: <your theme url>
Description: <theme descriptiton>
Version: <theme version>
Author: <your name>
Author URI: <your website>
*/
//some CSS code
To make a wordpress theme, remember that you must create those files in your themes sub-directory. There are another files like single.php, home.php, archive.php, comments.php, sidebar.php, etc. But it’s optional as this guide is created for beginner. We will cover these files later in more advanced guide.
Okay, I think the theory is done. Next, lets get to the practical and make our first theme.



