Call Us Toll Free - US & Canada : 888-818-9916 UK : 800-069-8778 AU : 1800-990-217
How to make template WordPress

How To Make Template In WordPress

Spread the love

There are thousands of different things that you can do with a WordPress website. And of all, creating a template in WordPress is what we are going to talk about here. Heard about it?

Not sure how?

Don’t worry; we have got your back. Walk along with us to see how can you create page templates for your WordPress website and then use it to create pages.

Apparently, a lot can be done with created templates and that’s why we are here to educate you on the same.

Why Do You Need To Create WordPress Templates

Before we see how to create a template in WordPress, it is important to know why and most importantly, what?

A custom page is one that enables WordPress website owners to create pages and posts in a WordPress website. In case, you base all of your pages on the default WordPress page template, the entire website would turn monotonous.

This is where WordPress gives you the ease to design page templates, all by yourself, add a personal touch and customize your WordPress website on the go.

When we say, customizing the WordPress website page template, you would definitely need to have significant knowledge about HTML, CSS, and PHP. Ok, you don’t have to sit and start reading the above.

All you got to do is hobble and see how you can create a WordPress template.

Creating custom templates helps you give your website a better and personalized look, alter the layout of the page and also, define the manner in which your WordPress page would look like.

Now, this sounds enticing. Without wasting any time further, let’s see how can we create a custom page template in WordPress.

How to Create Template In WordPress?

As stated above, you would need to have sound knowledge of HTML, CSS, and PHP, in order to know what you are doing and how are you creating the template in WordPress.

Open Text Editor

  • Open a normal text editor. It could be Notepad or WordPad. Here, we are using Notepad++ as our text editor. Once you have opened the editor, create a new file and copy-paste the code given below.

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

This is a PHP code that will tell WordPress about the presence of a template named: PageWithoutSidebar. In simple terms, it suggests that there is a template with the name PageWithoutSidebar.

After you have copied the above and pasted in the file, save the file with the name, same as that of the template that is PageWithoutSidebar.php.

Remember, you can create the template with the name of your choice and save it as the name. Irrespective of what the name is, the file extension has to be PHP.

Connect With Website

The next step is to connect with your WordPress website. You can either do with you the admin dashboard or through the FTP.

After you have successfully logged in to the WordPress website, next you need to go to the current theme folder. Trace the path as:
htdocs–> WordPress folder–>wp-content–>themes–>your template file.

Here, update the custom theme file you have just created within the existing theme: the one as PageWithoutSidebar

Editing the Page

Once again login to the WordPress admin page. Whether you want to create a whole new page or edit the existing one, you need to follow a similar process.

  • Click-open the edit screen.
  • Now, move down to the section of page attribute.
  • Under the drop-down menu, you will find the template that you uploaded in the step above.
  • Click on it to select the same.
  • Once you change the template and click on it, you will find a new page, one that is totally blank. (Since you have nothing to display now, it is kept blank, as, of now)

You need not panic. We will help you add elements in the page, in the upcoming steps.

How to Edit the Page?

Ok, here we are all set to edit the custom page file. It is similar to all other theme files in the WordPress website and you can edit it as and how you like it. From HTML tags to PHP files, you can customize the page as per your convenience.

One thing you can do is open any of the existing templates, copy the HTML code and then paste the code in your new template.

To do so:

  • Open the FTP client.
  • Here, hover around the page. You will find a file name page.php. You cannot access the file without downloading it.
  • So, you would need to download the file and once you have it, click open the same in a text editor
  • Here, copy the entire content of the page, except the one that reflects the header.
  • If you aren’t sure what the header is, it is present at the top and is commented.
  • Open the custom page of your WordPress website and then you can paste the copied content here.

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

<?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 the file and you are now ready with your WordPress template. Chat Now

Join the discussionSHARE YOUR THOUGHTS