You might get caught up in a situation where you want the default Single.php file to return a different layout and also want a separate whole new layout for your Custom Post.

How to Create a Custom Wordpress template for Custom post type

I was caught up there sometime back not knowing the answer is quite simpler than i thought. I tried creating two separate templates and added a conditional statement in the main Single.php file to load a template basing on the request made.

Truth is i got lost in the logic and the whole procedure didn’t work out. I don’t want you to go through the same stress that i went through searching an array of forums for a simple solution that am about to share below.

To load a custom post type in it’s own template, you don’t need to write any codes for it but rather do the following:

  • Copy and Paste the Single.php theme file
  • Edit it to your favorite layout
  • Rename the file in a format that begins with single-your_custom_post_type.php implicating if your custom post type is called ‘matches’ then the custom template should be named single-matches.php.

The theme will automatically detect and load the template if a custom post request is made. That’s the simple solution that took me days to figure out.