Title: using the include function
Last modified: August 21, 2016

---

# using the include function

 *  Resolved [nimbus3000](https://wordpress.org/support/users/nimbus3000/)
 * (@nimbus3000)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/using-the-include-function/)
 * Hi everyone,
 * I am new to wordpress and PHP and trying to find my way around.
    I have placed
   a file with a single function in the base folder (C:\xampp\htdocs\wordpress).
   within the [insertphp] tags, I have include ‘<\name of the file>’. I have also
   tried to include the entire path to the file, but that doesnt work either. I 
   am getting the following error: Warning: include(1): failed to open stream: No
   such file or directory in C:\xampp\htdocs\wordpress\wp-content\plugins\insert-
   php\insert_php.php
 * Can someone please help me.
 * [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)

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

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 11 months ago](https://wordpress.org/support/topic/using-the-include-function/#post-5070662)
 * Put your function in the functions.php file of your Child Theme instead.
 *  Thread Starter [nimbus3000](https://wordpress.org/support/users/nimbus3000/)
 * (@nimbus3000)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/using-the-include-function/#post-5070663)
 * Thanks a lot for the reply Andrew, but can you explain the answer a little. I
   am very new and not conversant with what a child theme is.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 11 months ago](https://wordpress.org/support/topic/using-the-include-function/#post-5070664)
 * Sorry I misread your thread title and thought this was regarding a theme, not
   a plugin.
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/using-the-include-function/#post-5070683)
 * Try this:
 *     ```
       [insert_php]
       include( $_SERVER["DOCUMENT_ROOT"] . "/public/document/location/of/file.php" );
       [/insert_php]
       ```
   
 * Replace
    `/public/document/location/of/file.php` with the public document location
   of the file you’re including.
 * As an example, if the URL to the file was [http://example.com/testing/file.php](http://example.com/testing/file.php),
   then replace
    `/public/document/location/of/file.php` with `/testing/file.php`
 * For this particular include, assuming the file you’re including is named file.
   php, this should work:
 *     ```
       [insert_php]
       include( $_SERVER["DOCUMENT_ROOT"] . "/wordpress/file.php" );
       [/insert_php]
       ```
   
 * Will
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/using-the-include-function/#post-5070851)
 * Because there has been no response, I’m assuming the original poster resolved
   the issue.

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

The topic ‘using the include function’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/using-the-include-function/#post-5070851)
 * Status: resolved