How to Create a Custom Page in WordPress, Free WordPress Themes, Blogger Templates
Friday, August 25, 2017

How to Create a Custom Page in WordPress

Once a WordPress theme has been installed, all the pages and posts of the website or blog appear according to its design and template. The posts and pages have their specific layout and template. Unfortunately, most of themes don't allow the page customization facility within their themes setting dashboard.  A custom page allows you to have different layout in appearance from regular pages in WordPress. The only way out of this issue is to opt for a custom page template. In this article, we will show you how to create a custom page in WordPress.

How to create Wordpress custom page

What is a WordPress custom page


WordPress default theme allows you to create posts and pages only. Your WordPress theme controls the appearance of your pages by utilizing its template file called page.php
This page.php template file reflects all single pages that you create in WordPress. However, not all pages are the same. Little changes in their layout and appearance can make them unique and according to users requirements.

Creating a custom page template in WordPress requires a basic understanding of HTML, CSS, and PHP but you can also create any custom page through "Page Builder Plugins". These plugin can be downloaded free from WordPress.Org but to avail all the premium features you have to buy it. Let’s start creating your first custom page in WordPress.

Why need a custom page


A WordPress custom page template could be used for some of the following purposes.  include:


  • A beautiful landing page on home
  • Show recent posts of each category
  • Embed Google Map or any script
  • List of all authors
  • Recently uploaded images
  • Custom design page for the portfolio
  • Contact page
  • Business or services inquiry form 
  • WooCommerce products presentation

To create a custom page in WordPress


As mentioned above, you can design a custom page template with the help of HTML. PHP and CSS or by using a third party Page Builder Plugin.

1) Creating a custom page through WP Plugin


Nowadays more than 80% bloggers are not webmasters at all. Therefore I will demonstrate the DIY method so all viewers can follow and understand the whole process easily.

There are many Custom Page Builder Plugins available on WordPress.Org but all of them have restricted the pro features and you have to buy the Pro version to its premium features. Therefore I only recommend Page Builder By SiteOrigin because it is free and it has a user friendly interface.

SiteOrigin Page Builder makes it easy to create responsive column based content, using the widgets you know and love. Your content will accurately adapt to all mobile devices, ensuring your site is responsive (mobile-ready).

Watch Demo Video of Page Builder by SiteOrigin




Visit Publisher's Page      OR      Download The Plugin


Upload and install Page Builder in the same way you’d install any other plugin and after installing the plugin watch the following video to see how it works.




2) Creating a Custom Page in WordPress  Manually


When you need to create a custom page in WordPress manually you must have at least some basic knowledge of HTML, PHP and CSS. Let's start designing a custom now...

Open NotePad++ Plain Text editor (download and install it from NotePade++ if don't have on your desktop) and copy + paste this code in first line of the blank page and the save the file to mycustompage.php

<?php /* Template Name: Mycustompage */ ?>

as you can see in the image below;


Creating Custom Page File


This code simply give instructions to WordPress that this is a template file and it should be recognized as 'Mycustompage'. You can give any name to this file as long as it makes sense to you.

As you already saved this file, after adding the code line, to Mycustompage.php and now it's the time to upload this template php file in theme dirctroy in your webhosting cpanel dashbooad.

Login in your Cpanel and open root directory of your domain where the script files are installed. Find /wp-content/themes/   and Upload the file Mycustompage.php

Now you need to login to your WordPress admin area to create a new page or edit an existing one.
On the page editing screen, scroll down to ‘Page Attributes’ section, and you will find a template drop down menu. Clicking on it will allow you to select the template you just created.


How to change template



Now if you change template and visit this page, then you will get to see a blank page. That’s because your template is empty and does not tell WordPress what to display. Don’t worry, we will show you how to easily edit your custom page template.

Editing Your Custom Page Template

Your custom page template is like any other theme file in WordPress. You can add any HTML, template tags, or PHP code in this file. The easiest way to get started with your custom page is by copying the existing page template provided by your theme.

Open your FTP client and go to your theme folder. There you will find a file called page.php. You need to download this file to your computer.


Designing Custom Page template


Open the page.php file in a plain text editor like Notepad++, and copy all its content except the header part. 

Now open your custom page template file what you just created Mycustompage.php and paste it at the end.



<?php /* Template Name: Mycustompage */ ?>
<?php get_header(); ?>
<div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">
        <?php
        // Start the loop.
        while ( have_posts() ) : the_post();
            // Include the page content template.
            get_template_part( 'template-parts/content', 'page' );
            // If comments are open or we have at least one comment, load up the comment template.
            if ( comments_open() || get_comments_number() ) {
                comments_template();
            }
            // End of the loop.
        endwhile;
        ?>
    </main><!-- .site-main -->
    <?php get_sidebar( 'content-bottom' ); ?>
</div><!-- .content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>


Save your custom page template file and upload it back to your theme folder using FTP or direct via Cpanel Upload facility.
You can now visit the page you created using custom page template. It will now look exactly like your other pages in WordPress.
You can now continue editing your custom page template file. You can customize it in any way you want. For example, you can remove the sidebar, add custom PHP code, add any other HTML you want.
You can add the content by editing the page in WordPress page editor screen. You can also leave the content area in page editor completely empty, and add custom content directly in your page template.
How to Create a Custom Page in WordPress Reviewed by WP Guide on 10:02 PM Rating: 5 Once a WordPress theme has been installed, all the pages and posts of the website or blog appear according to its design and template. The p...
Next
This is the most recent post
Previous
This is the last post

No comments: