menu
Ad goes here

Sunday, 10 December 2017

How to create a custom page in WordPress?

How to create a custom page in WordPress?
WordPress allow you to create page and post in a default design, but if you like to design your homepage or other inner pages different from each other then you have to use custom page. In this article, I will show you how to create a custom page in WordPress.

First open your html editor, Notepad or Notepad++ or Sublime Text or anything which you have and create a blank page.

Now access the theme folder ( \wp-content\themes\themename\) and find page.php and open it in your editor, copy everything and paste it in your newly created blank page. Now you can see commented area which you have to remove and add following line to give template name.

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


Now the complete page will be with following code.
<?php /* Template Name: My Custom Page */ 

get_header(); ?>

<div class="wrap">
 <div id="primary" class="content-area">
  <main id="main" class="site-main" role="main">
   <?php
   while ( have_posts() ) : the_post();
    get_template_part( 'template-parts/page/content', 'page' );    
    if ( comments_open() || get_comments_number() ) :
     comments_template();
    endif;
   endwhile; 
   ?>

  </main>
 </div>
</div>
<?php get_footer();



Save the file inside \wp-content\themes\themename\ folder. I have given the file name ‘custom.php’ and you can give the file and template name (Template Name: My Custom Page) as per your choice.

You are almost done and now access your admin section and create a new page from left panel and choose template name – ‘My Custom Page’ from right panel and add content in the editor area and publish it.

Choose WordPress Custom Page Template

The WordPress custom page is ready and you can access the page from your website link. By using this custom page you can separate it from other pages design without affecting entire site design and format.

3 comments:

  1. Thanks for the post.Your article is very informative. I think this article has a lot of details needed, looking forward to your new posts. If your interested in getting the service of website agency then visit Web Design Service Rancho Cucamonga.

    ReplyDelete
  2. You have shared a nice information about how to create a custom page in WordPress. it is perfectly described the process of page creation. If you want to know more about WordPress website development process, visit Professional Designers.

    ReplyDelete
  3. Nice article about WordPress. here, You have very well described the process of the custom page creation in the WordPress. If you are interested to know more about wordpress website design prices, Visit Theportwebdesign.com

    ReplyDelete

Books for you (Crafted with )