First, you need to open a text editor  add the blank file add this line of code at the top:

<?php /* Template Name: Custom Page Template */ ?>

Editing Your Custom Page Template

Your custom page template 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 the page.php file in a plain text editor like Notepad, and copy all its content except the header part.

Your custom page template would now looks like this:

<?php /* Template Name: Custom Page Template */ ?>
<?php get_header(); ?>
<div id="primary" class="content-area">
    <main id="main" class="sitemain ">
        <?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( ‘bottom' ); ?>
</div><!-- .content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Save your custom page template file using FTP and you can remove the sidebar, add custom PHP code, add any other HTML you want.

Related Article


0 thoughts on “How to Create a Custom Page in WordPress”

Leave a Reply

Latest Article

Blog

Zhang Shuai reaches Guangzhou Open semis, Alize Cornet goes out

Zhang Shuai turned into the main seeded player to progress to the elimination rounds of the Guangzhou Open as Alize Cornet was disposed of 6-1, 7-6 (7-5) by Yanina Wickmayer on Thursday. Zhang, additionally the Read more…

Blog

Pan Pacific Open: Caroline Wozniacki title defense on track with win over Shelby Rogers; Johanna Konta out

Defending champion Caroline Wozniacki ripped at her way into the Pan Pacific Open quarter-finals on Thursday, barely maintaining a strategic distance from the destiny fourth seed Johanna Konta prior endured in Tokyo. Previous World No Read more…

Blog

Microsoft Surface Book

The tablet, called the Surface Book, has a 13.5-inch screen and measures 3.34 pounds with a separable console plainly placing it in rivalry with Apple’s MacBook Air and the numerous, numerous Microsoft accomplices who make Read more…