Title: Add PHP to Pages
Last modified: August 20, 2016

---

# Add PHP to Pages

 *  [wjack2010](https://wordpress.org/support/users/wjack2010/)
 * (@wjack2010)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-php-to-pages/)
 * How can I add PHP into WordPress Pages?

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

 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-php-to-pages/#post-2367509)
 * There’s a few plugins like
    [http://wordpress.org/extend/plugins/wp-exec-php/](http://wordpress.org/extend/plugins/wp-exec-php/)
 * But just for info ive seen a few cases where the code fails.
 * The best way really is a custom page template, or shortcode, depending what you
   need
 *  Thread Starter [wjack2010](https://wordpress.org/support/users/wjack2010/)
 * (@wjack2010)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-php-to-pages/#post-2367532)
 * Well basically, I just need 1 page where it has my current theme in, with a PHP
   form on it. I’ve already coded the PHP form but have no way of getting it in 
   a page.
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-php-to-pages/#post-2367534)
 * Unfortunately, forms is where that plugin usually fails the most
 * Best way to add your form is to make a copy of page.php, place your code right
   under the_content on that new file, name the file whatever you want.
 * Then at the top of the file add
 *     ```
       <?php
       /*
       Template Name: Whatever
       */
       ?>
       ```
   
 * And you have a template. Simply make a new page through the add new interface
   in WP, and assigne your new template to that page from the attributes menu
 *  Thread Starter [wjack2010](https://wordpress.org/support/users/wjack2010/)
 * (@wjack2010)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-php-to-pages/#post-2367588)
 * Thanks.
 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-php-to-pages/#post-2367659)
 * Normally, you can only choose custom templates on WP _pages_ (not on posts). 
   So another way to do this is to create your own shortcode and run your code that
   way, but that takes some custom coding…
 * [http://www.packtpub.com/wordpress-3-plugin-development-essentials/book](http://www.packtpub.com/wordpress-3-plugin-development-essentials/book)

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

The topic ‘Add PHP to Pages’ is closed to new replies.

## Tags

 * [Coding](https://wordpress.org/support/topic-tag/coding/)
 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 5 replies
 * 3 participants
 * Last reply from: [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/add-php-to-pages/#post-2367659)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
