How to create wordpress page templates

Recently i had to find a way to List subcategories the way wordpress lists posts. After some extensive searching and facepalming that this isn`t included in the built-in functionality I started researching how to develop this and stumbled upon wordpress page templates. I found that to be the easiest way to build and use custom loops or any kind of custom PHP for that matter. The best part is that creating a page template is as easy as inserting several lines in a PHP file from your favorite text editor, upload it in your themes folder and you are good to go…Your Page template file must start with:

<?php
/*
Template Name: Snarfer
*/
?>

After you upload it in your wordpress folder you can access it in the page attributes of the “Add new page”

Of course this is just the beginning…you can now start coding. And including your code is as easy as adding a new page.