Adding custom php code as page template
under /wp-content/themes/themename/ make a new file templatename.php which is like
<?php /* Template Name: templatename */ ?>
then when you go to ‘add page’, you will have an extra option to page attributes groupbox (template)
if the pageattributes not appear, or the template you created is not there, go and change the wordpress theme to something else and restore it back to your custom. the page attributes will appear!