For those of you who are familiar with PHP then you'll know that using an include is an effective way of adding a file that is easily up-dateable site-wide. A good example would be a navigation, header or footer that is 'included' on the page from a source file (usually a .php or .html file). You may however not be aware that a php include for an 'external file' can also be added from within WordPress itself and this is extremely useful say if you have a plugin or external application that you have created. There are various ways to do this and these are listed below:-

Include an External File within a WordPress Template

The key here is using the term 'ABSPATH' or WordPress will throw up errors such as “syntax error, unexpected T_STRING”

Include PHP within WordPress Plugin

You can also achieve the same effect by using a plugin to run PHP script from within WordPress. There are a few plugins that can do this, but a simple way to achieve this is with the following php code that can reference any file from the site root and inject it into WordPress via your plugin:-

PHP Include from Root

if you not using WordPress, or are interested, then you can also use any of the following snippets to php include  from Root:-