Link to home
Start Free TrialLog in
Avatar of Pete Winter
Pete WinterFlag for United Kingdom of Great Britain and Northern Ireland

asked on

wordpress theme creation

I am creating a theme.

I want the contents of the home page to be a static php file with a dynamic header and footer, then all other pages grab the contents from the relevant wordpress page.

I understand I need a index.php file in my theme, but a little unsure on the structure.

Can my index file say if this is the home page view the home.php template file, then for all other pages use the page.php file.

Can you please show me the basics for setting this up.?
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Here https://codex.wordpress.org/Theme_Development is the 'official' documentation.  You don't write the 'index.php' page, that is part of the Wordpress structure.  You should have a basic Wordpress installation so you can see where the parts are.  So far, you are kind of off in the wrong direction.

This is a view of my Wordpress installation directories.  Your 'theme' would go in the 'themes' directories under 'wp-content'.
User generated image
Avatar of Pete Winter

ASKER

So shall I just leave the index.php file blank?

Do I just put home page contents in home.php

then contents for all other pages with the loop in page.php ?
None of the above.  To create a Wordpress theme, you really need to read that article, probably several times.  My current Wordpress 4.2.5 installation is 19 MegaBytes with 1601 files in 150 directories.  Wordpress is a very complicated application and you should be working only on the parts in the 'themes' directory.

When I have needed a 'new theme', I have just copied the stock theme and modified it.  That leaves about 95% of Wordpress un-modified.
Yes I understand creating the theme folder and location and the style.css, etc.

I am just trying to understand the main difference between the index.php and home.php files. Currently my index.php is blank and I have everything in the home.php for the home page, but I assume I need to tell wordpress to use home.php for my home page, then page.php for every other page. Do I need to do that in the index.php file?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks. I have worked out what I am doing wrong. Thanks for your advice.
You're welcome.  Good luck with your project.