WP Include File: a WordPress Plugin
WP Include File utilizes the WordPress Shortcode API to include the contents and output from PHP code located in an external file within the post content.
DOWNLOAD >>
Features
- Advanced form security, nonce and whitelist registration of option variable to be written in the database
- Options stored as one array in the database to minimize database cluster
- Unregistration of option variable from whitelist on deactivation
- On uninstall option array is removed from the database. No trail left behind
- Functional and user-friendly options page
- Help page build-in
Why do you need WP Include File?
WP Include File is needed because any PHP code you type within the tinyMCE will not be rendered when the post content is displayed. Hence instead of having to create templates for each specific task/post, you can just create localized specific files and just include them in the post content using WP Include File.

Furthermore it becomes handy when applying specific styles to certain posts that are not required by the rest of the site. Just enclose the style definitions in the style tags, save it in a file and include it in the specific post using WP Include File. Hence you save on bandwidth and load times by not loading unecessary style definitions where they are not needed.
The WP Include File plugin comes with an intuitive and functional options that will have you up and running in no time.

If you want to learn more about the philosophy behind WP Include File you can read this article: Using the WordPress Shortcode API to include an external file in the post content
Invoking WP Include File using the Shortcode within the tinyMCE
WP Include File can be invoked using the Shortcode . The Shortcode accepts three attributes: file, path and masterpath. It will include the contents of the specified file at the location the Shortcode is placed within the post content.
Usage:
[include file="MyCustomFile.php"]
This will include the contents of the file MyCustomFile.php located in the directory selected on the WP Include File Options page.
For example:
If you selected Site Root Directory on the Options page, the full path to the file to be included will be MyCustomFile.php
If you selected Theme Root Directory on the Options page, the full path to the file to be included will be /MyCustomFile.php[include file="MyCustomFile.php" path="/MyDirectory/demos"]
Thepathattribute will override any path extension specified on the WP Include File Options page. This will include the contents of the file MyCustomFile.php located in the directory /MyDirectory/demos relative to the Root directory selected on the WP Include File Options page.
For example:
If you selected Site Root Directory on the Options page, the full path to the file to be included will be MyDirectory/demos/MyCustomFile.php
If you selected Theme Root Directory on the Options page, the full path to the file to be included will be /MyDirectory/demos/MyCustomFile.php[include file="MyCustomFile.php" masterpath="/home/SomeUser/SomeDirectory/SomeOtherDirectory/MyDirectory/demos"]
Themasterpathattribute will override all the selections on the WP Include File Options page. This will include the contents of the file MyCustomFile.php located in the directory /home/SomeUser/SomeDirectory/SomeOtherDirectory/MyDirectory/demos.
For example:
The full path to the file to be included will be /home/SomeUser/SomeDirectory/SomeOtherDirectory/MyDirectory/demos/MyCustomFile.php
FAQ
- I am using the path attribute and my file is not included.
The first forward slash (/) should be included when declaring a path extension using the path attribute. For examplepath="/MyIncludeDirectory/Content"
Version History
- v. 1.9.10.14
First public release.
If you have any comments or suggestions or bugs to report please leave them below. Alternatively you can use our contact form.


, or by using our 



is it possible to insert a query string on the inserted file? For example something like that: [include file="media.php?var=34700"]
The current version does not support query strings. That is a great idea though! We will look into it.
Seems very useful.. but.. how do I get other plugins and short codes to work within the include file? It seems that it ignores and types of plugins or short codes that I use in the include file. For example.. the file that I’m including is an html file (kit.html) and in that file I’m using a plugin called “Wordpress Tabs Slides” in addition to another custom plugin that is called via a short tag. Is there a way I can get these to work in the included html file? Should I change it to a php file somehow or something like that? Do I have to make a call to the plugins? I’m not sure what is needed. Could you please provide some insight? Thank you very much.
You need to give the .php extension to your file so the PHP script will be executed on inclusion. The shortcodes within the included file will not work. You will have to figure out the corresponding plugin function call to the shortcode and use that instead, in the included file.
Can this be used to run the content of say a shopping cart within the wordpress content area, or is it really only to display a single PHP page/file?
Thanks
Yes, it is intended only for including a PHP file. The goal is to be able to utilize the PHP functions within post content text, which WordPress does not allow. It can be also used to just insert CSS and/or JavaScript specific to that post.
Hello,
Very good plugin, even excellent idea. But, jJust a question please :
Do you know how i can include the 10 last posts of my blog in a page ? I mean, i cannot put two times a “if have post, while have post…” in the loop, already called by page.php
An idea ?
Thanks for your comments. You cannot use WP Include File to include anything stored in the database. Take a look at the
query_postfunction. It should help you achieve what you are trying to do. Create a page template and usequery_postand The Loop to display your 10 last posts on the page.Hi AmberPanther Team
I was wondering if you can include a PDF file… It doesn’t work on first try (while a php file does work), so if there is anything I can do to display a PDF it would be a great help.
BTW you have written a fantastic plugin in wp-include-file!!
Hello,
you can include the link to the PDF file, but not the file itself. In order to display the PDF file on your page we recommend you trying one of the flash-based PDF viewers available. Thanks for your comments.
Thanks! Yours was the third plug-in I tried and the first that worked. My goal was to create a page that my weather station can update. The weather station sends up a text file with all the data, plus five jpegs, every 15 minutes. See it in action at http://mtsneffelspress.com/projects/wx/.
Dave, we are glad WP Include File was of help to you… Remember & Recommend the Panther
Hello AmberPanther
WP-Include File is a TRULY great plugin but the Wordpress search does not look in the included files. Do you have any suggestions to make a search that will find text in the posts AND in the included WP Include files ?
Jacinta, we are glad you are enjoying WP Include File. Unfortunately, the text in the included files is not found by the WordPress native search, as it only searches the contents of the database, and not the rendered page. There are a couple of workarounds: 1. Use keywords in the included filename, its name is stored in the database and WordPress search will find it. 2. Migrate to a custom search option on your site (e.g. Google Custom Search). The search engine crawlers render the page, thus they index all the information, including the contents of the included file. Hence, searches will return it in the results. Setting up a Custom Search is relatively straightforward.
Google Custom Search has worked really well with WP-Include File = Thanks Amber!
Hi, great plugin you created there. Just one question: Is it possible to take into account the tag in included files? And if yes, then how? Reason is the following: I use the plugin to include a HTML file generated from LaTeX document in a post, and this document is updated from time to time. However, the document is also long enough to have a after the introduction. So how could I make your wonderful plugin to allow “read more”?
Thanks so much!
Hello… at the moment this feature is not supported and it is not in our immediate plans to support it, as it would greatly increase the implementation complexity of the plugin. Our suggestion would be to split the html file in the parts (i.e. multiple files) you want, and then use the WP Include File shortcode to load the different files, separating each shortcode call with the
moreshort-tag. Thank you for choosing WP Include File…Hi is it possible with your program to include a php file from another web site which shows up on my website not as a link but the content of that file.
Regards Ben
This is not an option with WP Include File.