Without doubt, people will see your homepage in the very beginning when they enter your website, so you have to make it as informative and attractive as possible to pick readers’ attention effectively. Generally, the homepage is a static front page that is able to show the main point of your website, and can present your most recent posts in reverse chronological order clearly. To make it unique and different from other webpages in your site, you need to make use of custom page template snippet and WordPress admin panel.
In the following, we’d like to tell you how to create a custom WordPress homepage for your site. Note that some certain degree of HTML and CSS knowledge is required.
Create a Custom WordPress Page Template
In order to create a custom page template, you need to paste the following code in a blank file using your text editor.
<?php /* Template Name: My Custom Page */
As you start this step inside a PHP comment, you can save and name this new file as templatename.php, such as homepage.php.
Then, you need to do some php makeups. You can start out by calling WordPress header and footer. In the following, we have listed some basic mini cheat sheets that are helpful for you to carry out this step.
<?php bloginfo('name'); ?> – Title of the Blog, or Blog Name <?php wp_title(); ?> – Title of a Specific Page <?php bloginfo('url'); ?> – Exact URL for the Site <?php bloginfo('description'); ?> – Site’s Description <?php bloginfo('template_url'); ?> – Location of Site’s Theme File <?php bloginfo('stylesheet_url'); ?> – Link to the Style.css location <?php bloginfo('rss2_url'); ?> – RSS Feed URL for the Site <?php bloginfo('pingback_url'); ?> – Pingback URL for the site <?php bloginfo('version'); ?> – WordPress Version Number <?php get_footer(); ?> – Displays Footer.php file content <?php get_sidebar(); ?> – Displays Sidebar.php file content <?php comments_template(); ?> – Displays Comment.php file content <?php the_content(); ?> – Displays the Content of the Post
After finishing editing, you just need to save it and upload it to your theme directory, which looks like /wp-content/themes/themedirectory/.
Now, login to your WordPress admin panel and click Pages < Add New in the left column. Since you have uploaded this custom page to your theme folder, it will be listed in the Template dropdown menu automatically. Choose it and appoint it as your main page in the Attributes box.
Go to the Setting section that is on the left navigation of your WordPress dashboard, and then click on Reading button. At the top of this screen, you can see the Front Page Display setting, simply check the box that is next to the static page option. Now, you need to select HOMEPAGE from the Front Page drop down menu, and pick the Recent Posts you have created earlier. After completing all of these processes, hit the Save Changes button and check your custom homepage.