Title: php includes in pages
Last modified: August 18, 2016

---

# php includes in pages

 *  [mango23](https://wordpress.org/support/users/mango23/)
 * (@mango23)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/)
 * How do I include a php include into a static page?
 * thanks,

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

 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310308)
 * What do you mean by a “static page”? Are you referring to a WordPress “Page” (
   which aren’t static BTW) or a true static page like an .html document?
 *  [lashout](https://wordpress.org/support/users/lashout/)
 * (@lashout)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310309)
 * <?php include(‘filename’); ?>
 * or
 * <?php require_once(‘filename’); ?>
 *  Thread Starter [mango23](https://wordpress.org/support/users/mango23/)
 * (@mango23)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310311)
 * I mean the wordpress ‘page’.
 * when i add <?php include(‘filename’); ?> , it just puts that there and not the
   file.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310314)
 * Unless you run a plugin that allows for running PHP in posts and Pages – you 
   can’t.
    Here is one of those plugins: [http://wordpress.org/support/topic/52928?replies=6](http://wordpress.org/support/topic/52928?replies=6)
 *  [lashout](https://wordpress.org/support/users/lashout/)
 * (@lashout)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310316)
 * Ok you really need to link us to the page your tring to do this too…
 * Also you can’t just copy what I have and paste it in the post section of the 
   site and it work. You will need to edit the template and then change the file
   name to the includes that you need.
 * example
 * <?php
    include(‘test.php’); ?>
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310317)
 * Using an “include” in a template or using php in a Page – those are two different
   things. My impression was the OP asked for a Page, not a template.
 *  [lashout](https://wordpress.org/support/users/lashout/)
 * (@lashout)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310320)
 * Yea I got that impression after I read the other post …
 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310321)
 * As said, you can’t do PHP in posts. You’ll need a PHP plugin or even better, 
   make a custom Page template.
 * [http://codex.wordpress.org/Pages#Page_Templates](http://codex.wordpress.org/Pages#Page_Templates)
 *  Thread Starter [mango23](https://wordpress.org/support/users/mango23/)
 * (@mango23)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310322)
 * exactly , i was trying to add a php include into a ‘page’ and instead of the 
   code running I got the text of the code.
 * thanks moshu for your help.
 * i was hoping it would be easier then creating a custom template with the code
   in it. But i guess the plugin might be easier so i will try that.
 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310325)
 * Not hard. Just make a copy of your `page.php` and rename it to something else.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310326)
 * Plus add some lines at the top 🙂
 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310332)
 * You can also try CG-QuickPHP for something THAT simple (i.e., one ‘function’ 
   used, and ‘static’ variables…). The format would be like:
 * `<quickphp include('filename'); />`
 * Note of course that it’s great if you know the absolute path to the file — but
   not if you want to use PHP variables to determine a file path, etc.
 * Just thought I’d toss in another (fast) option.
 * -d

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

The topic ‘php includes in pages’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 5 participants
 * Last reply from: [davidchait](https://wordpress.org/support/users/davidchait/)
 * Last activity: [20 years, 5 months ago](https://wordpress.org/support/topic/php-includes-in-pages/#post-310332)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
