Post Templates in WordPress...Finally

I know this has been out for a while, but I just happened to stumble across it. I build a lot of custom WordPress themes and I often use page templates to develop custom functionality. I don’t usually have the need to give posts a specific template, but it would be nice, right? In the past I had to use a plugin to give WordPress this functionality but now it’s finally baked in!

WordPress 4.7 brought about this change and here’s how to do it:


<?php
/*
Template Name: Custom Post Layout
Template Post Type: post
*/

Add that code to the top of your post template and you’re good to go. You can even make specific templates for custom post types. This is such a powerful feature that really extends WordPress without having to build in any “hacky” work-arounds.

Comments, Thoughts?

For now, please find me on Twitter (@erickarbe) and let me know what's on your mind. Or, find me on Google.