How to create a custom page template for WordPress Twenty thirteen theme?
It is easy! You should always work with a custom theme or a child theme when you start altering and adding custom code in WordPress. This is to avoid overwrite during WordPress updates and other conflicts with theme functions or plugins. You will need an ftp-connection and a simple text-editor. Just follow these steps to add a custom page template to Twenty Thirteen:
- Create your own child theme with the twenty thirteen theme as parrent theme.
- Inside your child theme folder, create a php-file named “my-template.php” or whatever you want to call it. The first code in this file should be:
* Template Name: Your template name
* @package WordPress
* @subpackage Twenty_Thirteen
* @since Twenty Thirteen 1.0
- Put your custom php-code inside this file. You could copy and paste the code from page.php to get you started.
- Put this file directly inside your child theme folder, or in a folder inside your child theme folder called “page-templates”. Both will work. This is done with and ftp-client. If you don’t want to use a child theme, put the file directly in the Twenty thirteen theme folder.
- Log in to your WordPress site and create a new page.
- On the right inside under “page attributes” you should be able to choose your new template using the template dropdown.
- Update or Publish your new page and you are done!
Download the source code for a childtheme + one page template, ready to use:
Page templates are made for specific pages or page-types:
Create a custom page template whenever you want a page to have a specific functionality or display content in a special way. Create as many custom page templates as you need, and use them on one or more pages in WordPress. You can also create custom page templates for other WordPress themes than Twenty thirteen.