Title: Creating A Custom PHP Template
Last modified: April 4, 2022

---

# Creating A Custom PHP Template

 *  [thecause12](https://wordpress.org/support/users/thecause12/)
 * (@thecause12)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/creating-a-custom-php-template/)
 * I am trying to create a custom PHP template for a single page in WordPress. I
   duplicated the original “page.php” file and added a custom code. I have renamed
   the file using the slug to everything from, “page-pagename.php” to “template-
   pagename.php”. For some reason it is not showing up in the templates dropdown.
   I also added this and a longer variation of it to the top of the PHP file:
 *     ```
       /**
        *    Template Name: name-of-your-template
        **/ 
       ```
   
 * I am not sure if I am doing this correctly or not. I am using the Storefront 
   theme for WooCommerce, and running WordPress 4.9.2.
    -  This topic was modified 4 years, 2 months ago by [thecause12](https://wordpress.org/support/users/thecause12/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [a2hostingrj](https://wordpress.org/support/users/a2hostingrj/)
 * (@a2hostingrj)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/creating-a-custom-php-template/#post-15526609)
 * I strongly suggest to take a look at the developer handbook:
 * [https://developer.wordpress.org/plugins/plugin-basics/](https://developer.wordpress.org/plugins/plugin-basics/)
 *  Thread Starter [thecause12](https://wordpress.org/support/users/thecause12/)
 * (@thecause12)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/creating-a-custom-php-template/#post-15534589)
 * I went over the link, I am not trying to build a custom plugin but a custom php
   template page that will run my own PHP code.
 *  [a2hostingrj](https://wordpress.org/support/users/a2hostingrj/)
 * (@a2hostingrj)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/creating-a-custom-php-template/#post-15537004)
 * >  I am not trying to build a custom plugin but a custom php template page that
   > will run my own PHP code
 * The recommended way is by making a plugin.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Creating A Custom PHP Template’ is closed to new replies.

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [a2hostingrj](https://wordpress.org/support/users/a2hostingrj/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/creating-a-custom-php-template/#post-15537004)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
