I have to achieve a very specific task in the project I'm working but I have no clue on how to start:

  • Develop a new front page to override the current index page;
  • The page cannot be created as a Wordpress Page because we'll have to edit its PHP code;
  • The header and footer must remain the same as any page in the blog;
  • The page must not be deleted when the theme is updated;

Is it possible to achieve?

  • Yes this is possible I can give you a solution but what do you mean by override the index page? You mean you want your new page to load as the home page when the website loads?
    – wuno
    Commented Feb 11, 2016 at 20:49
  • Does the current theme your working in have a child theme setup?
    – wuno
    Commented Feb 11, 2016 at 20:49
  • @wuno, exactly! But I don't know how to check if my current theme accepts child themes. I thought every theme could accept a "-child" theme. Commented Feb 11, 2016 at 21:01
  • I have never seen a theme that does not allow a child theme. I think you are going to be pretty darn happy with my answer bro. Seriously this is pretty easy so do not be intimidated and let me know if you have anymore questions.
    – wuno
    Commented Feb 11, 2016 at 21:06

1 Answer 1


Create a new theme folder next to your current theme and name it, ThemeName Child Theme

In the new child theme folder create a file names


In the header of that file add this,

 Theme Name:     My Child Theme
 Theme URI:      http://www.example.com/myTheme
 Description:    your Child Theme
 Author:         your name
 Author URI:     http://www.example.com
 Template:       Main theme name
 Version:        1.0.0

@import url("../Theme/style.css"); /*  Path to main theme folder  */

/* =Theme customization starts here
------------------------------------------------------- */

Now that you have that done zip the file and upload it the same way you always upload a theme then activate it.

Any files that you want in your child theme you can add to the root of the new child theme dir. Basically if the file exist in the main theme root dir template files or functions.php etc. just create the same name of the file in the child theme main directory.

In the child theme create functions.php

Now you want to add a new version of the home page or any template file that exist. This works different then functions.php. functions.php gets loaded into the site along with your custom functions in the last file we setup. Template files will replace the original file.

Please see this example,

Beyond CSS and Functions modifications, you can also make structural changes to your theme by adjusting the php template files. This should be done with care, but by editing the PHP files you can adjust any part of the theme. Unlike editing the functions.php, where the original theme’s functions are imported automatically, PHP files are edited by replacing the file entirely with a new one. The theme’s original file is ignored and the new one is used instead. The first thing we need to do is replicate the old file before we start to modify it. To do this, simply copy and paste the theme’s original file into your child theme folder ensuring that the filename and location is exactly the same. For example, if we want to modify the the Foxy/includes/navigation.php, then we would copy and paste this file to foxy-child/includes/navigation.php.

So in your case if you wanted to modify the file index.php in the main theme you would copy and paste the file into the child theme and then go to appearance/editor make sure your child theme is selected then click on the file you want to edit. Make your edits and click save. Now your file has been saved and if the main theme gets updated it will not affect your child theme.

At that point if you want to modify which page using your new file go into pages/ select the page you want to edit and on the right side of the screen under Page Attributes click the drop down under Template and select the file you made the edits too.

If you have anymore questions let me know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.