1
votes

Im reading this tutorial Wordpress theming about converting an html site to WP, and it says

WordPress has a hierarchy of templates. None of them are called index (that name is reserved) so we need to rename our index file to something else.

So as per tutorial I renamed index.html to home.php. But when I go to themes it says that the theme is broken as it is missing a template and it shows as a valid theme only when I rename home.php to index.php.

Should I use index.php or keep home.php and it will recognize it after I have other pages like header.php etc?

ps. Tutorial is outdated?

1
if you have a chance to update the tutorial, then do it.ihsan
you can use index.php no problems. I had a quick look at that tutorial and it will give you the basics but research creating new templates for pages and it will be a bit clearer to you (you can select a template for pages by default wp will recognise files called page-CUSTOMNAME.php as template files (you need to note the name within comments in the file).David

1 Answers

2
votes

from the codex:

At the very minimum, a WordPress Theme consists of two files:
style.css
index.php

you need to keep the index.php file. home.php is also uses by wordpress template already as an option for front page as the website home page instead of default blog page - index.php.

home.php
The home page template, which is the front page by default. If you use a static front page this is the template for the page with the latest posts.

if you want to create a new template for home, you can for example create a new php file for new custom template and put the "template name" in the start of the file:

<?php
/*
Template Name: my template
*/

then set the page called 'home' to your new template from the admin panel.