WordPress Theme Development 2 - Minimum Main Index Template

Let's talk about index.php template file. This file is a must for WordPress theme. If any file is missing, WordPress will look for this main template file.

Currently, I will use these WordPress themes below as references for learning WordPress theme.

The minimum index.php would be:

But you might want to add something more in your main template file. In the posts loop, title of the post is added. It is good to mention the post is written by who and when. Categories and tags can be added in the posts loop too. Link pages, comments pop up link, comments template, next and previous posts link are also added in this main template file. Basically, this (as below) will be the default index.php for this theme.

There are different between __( ) and _e( ). __( ) is used when the message is passed as an argument to another php function. Whereas _e( ) is used for writing the message directly to the page. More detail can be found in Translating WordPress.

Related Posts

References

Comments

Comments powered by Disqus