Developer Snippet Diary

How to make custom homepage in WordPress

1. Using a Custom Page Template
Inside your child theme, create a file called: front-page.php

<?php
/* Template Name: Custom Homepage */
get_header(); ?>

<div class="custom-home">
    <h1>Welcome to My Custom Homepage</h1>
    <p>This is a fully custom layout built inside the child theme.</p>
</div>

<?php get_footer(); ?>

WordPress will automatically load this front-page.php file when “Homepage” is set to a static page.

Option 2:

1.
Inside your child theme folder, create a new file named for example: custom-homepage.php

<?php
/*
Template Name: Custom Homepage
*/
get_header(); ?>

<div class="custom-home">
  <h1>Welcome to My Custom Homepage</h1>
  <p>This layout is controlled by custom-homepage.php</p>
</div>

<?php get_footer(); ?>

???? The important line is /* Template Name: Custom Homepage */
This tells WordPress that this file is a page template and should appear in the Page Editor under “Template.”

2
Create a New Page in the Dashboard > In the Page Attributes section (right sidebar) > Choose Custom Homepage template >Publish the page ???

3

Go to Settings → Reading> homepage > “A static page” > Then set Homepage: to the Home page you just created

Posted by: R GONDAL
Email: rizikmw@gmail.com