I needed a “Home” menu item in my wordpress website, so I created a new page and named it “Home”, added it to my main menu item and then from Reading Settings I selected the “Home” as Front Page.
Now the problem is, the Home
is using page.php
instead of index.php
. I really need to get the home page using index.php as I have already designed the front page in my index.php
Could you please tell me how to make the home page use index.php instead of page.php
The simplest way would be to duplicate your index.php in to a file named home.php in your theme’s folder.
Another way would be to create a new page template same thing (copy index.php into it) and add this at the very top
Then head over to the page edit screen and select “My Home Page” from the template drop down
You can use the template_redirect action hook.
Add the following code to your functions.php file:
Note: Make sure to replace page_id with the id of the home page.
WordPress functions used: is_page, add_action
select home page as Posts page in setting>reading.it’ll call you index.php.
1.if you select home page as Front page ,it’ll follow page rule,so first search for front-page.php then page.php then index.php
2.if you select home page as Posts page ,it’ll follow post rule,so first search for home.php then index.php
read this may help you
So a quick fix would be to backup index.php and rename your original index.php to something like page-home.php, that way you can retain all the changes you have already made.