Creating A Custom Page In WordPress

Have you come across WordPress websites using different page layouts for different pages? Do you want the same for your website too? You can do so by creating custom pages.

In this article we are going to show how you can create a custom page using page builders as well as through PHP, HTML and CSS.

Below are steps to create a custom page using PHP, HTML and CSS

  1. Create a text file and name it custompage.php. You can replace the custompage with anything you find suitable.
  2. Add the below line of code to the custompage.php file
    <?php /* Template Name: CustomPage */ ?>
    
    <?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(); ?>
    
    

    Here CustomPage is the name that will appear in the Template dropdown menu when you try to create a new page.
    You can edit this page as per your requirements. Don’t want the sidebar remove the <?php get_sidebar(); ?> line.
    Want to add any HTML elements in the page? You can add them wherever you want in the code.

  3. Once you are done editing, you will need to upload the custompage.php file to your host.
  4. Using FTP navigate to your themes folder which should be in /wp-content/themes/ and upload the custompage.php file in it.

Your custom page is now accessible in Pages -> Add New under the Template dropdown menu.

Creating a custom page using Page Builders

If you find the above method confusing or difficult you can use page builders to create your own custom page template. The page builders make it as easy as dragging and dropping to create a custom page. Below are some of the most popular page builders to create a custom page.

  1. Beaver Builder


Beaver Builder allows you to take control of the page building process and shows the changes you make live. You can drag elements from the sidebar onto your pages and click on the elements on the page to edit their properties.

2. Elementor


Elementor allows you to create high end page designs easily and doesn’t restrict you in any way. It also shows the changes you make live. You get helpful widgets that make the job easy and many ready to use templates.

Conclusion

Creating a custom page helps with customizing your website as per your requirements. You can create different pages for different needs. If you are familiar with coding then you can create the custom page from scratch or you can use the page builder which make the job very easy.

Have questions or confused about something WordPress Related? Join Our Forum & ask a Question

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top