Categories
WordPress

Create custom post template

Step 1: Create a file new-template.php in theme folder

Navigate to wp-content->themes->twentytwenty( Note: Select any of the active theme in your wordpress), and create a new file new-template.php

Content of new-template.php is:

<?php
/*
 * Template Name: New Template
 * Template Post Type: post
 */
  
 get_header();  ?>

Template Name” is important to set, this is the name which will show in the list of template available.

You can copy code of singular.php in new-template.php and customize it because both have same functionality i.e single blog post-presentation

Step 2: Test

Navigate to new post->Post Attribute->Template

Now your template “New Template” will be listed in template list.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.