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:
- Install the plugin Custom Post Template and activate it
- Create a file inside the theme directory and name it something like post-unique-name.php
- 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 */
- 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.
- 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
