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.?
petewinterAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
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'.
Wordpress directory structure
petewinterAuthor Commented:
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 ?
Dave BaldwinFixer of ProblemsCommented:
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.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

petewinterAuthor Commented:
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?
Dave BaldwinFixer of ProblemsCommented:
In the themes directory for the most basic theme, this is what 'index.php' looks like.  This is the simplest one of the 10 or so themes I have.  And none of them have a 'home.php' file.  Wordpress isn't going to look for 'home.php'.
<?php
/**
 * Main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: https://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

		<div id="container">
			<div id="content" role="main">

			<?php
			/*
			 * Run the loop to output the posts.
			 * If you want to overload this in a child theme then include a file
			 * called loop-index.php and that will be used instead.
			 */
			get_template_part( 'loop', 'index' );
			?>
			</div><!-- #content -->
		</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
petewinterAuthor Commented:
Thanks. I have worked out what I am doing wrong. Thanks for your advice.
Dave BaldwinFixer of ProblemsCommented:
You're welcome.  Good luck with your project.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.