Create unique template for a specific post in WordPress

Do your WordPress site need a unique design or template for a specific single post? You can do it easily by following these steps:

  1. Install the plugin Custom Post Template and activate it
  2. Create a file inside the theme directory and name it something like post-unique-name.php
  3. Now open the file and place all necessary code you need for the post and add this code at very beginning of all code:
    /*
    Template Name Posts: Unique Name
    */
    
  4. Go to WordPress backend and edit the post. Just below the categories, you will find a box titled “Post Template” from where you can select template you want to use for the post.
    Unique Post Template WordPress
  5. If you want to apply this for any custom post type, you have to add some code to theme’s functions.php file. The code is:
    function my_cpt_post_types( $post_types ) {
        $post_types[] = 'products';
        return $post_types;
    }
    add_filter( 'cpt_post_types', 'my_cpt_post_types' );
    

    This is for custom post type called “products”. You can change it to anything else you need.

  • Ayaz Malik

    doesn’t work in latest version of wordpress.