Batch File Shutdown Commands – How To Shutdown, Reboot And Logoff

Ever wondered, How to create a custom template for a blog post in WordPress?

Well if you have, then you are in exact place to find about. In this article, we will explain about the ways of creating a template for a blog post in WordPress.

For starters, WordPresss comes with optimized built-in themes to kick-start our websites. In those templates is the built-in template for pages and posts we publish. Here are the steps to create your own blog post templates:

Step 1: Go to the root directory to where you have installed WordPress

Step 2: Now go to wp-content>themes>your_theme( the theme that is active in your website or blog )

Step 3: Create a new file and name it anything.php ( we have named single-blog-post.php )

Add up following code in this file:

 <?php /* 
* Template Name: custom post 
* Template Post Type: post, page
*/ ?>

<?php get_header(); ?>

 <main id="main" class="site-main" role="main">
 <?php
 while ( have_posts() ) : the_post(); ?>
 <h1><?php the_title(); ?></h1>
 <?php the_content();

 endwhile; // End of the loop.
 ?>
 </main>

<?php get_footer(); ?>

Save the file afterward writing the code.

Once the file is saved, open up a new post or an existing post. Now you will see a new option for switching template as shown in the figure below.

Change it to blog post ( the template we just created for blog posts ) and publish your post or preview it. You can see the result.