Set post template type

Edit and move code from single.php to functions.php