Title: Require Once / Include
Last modified: August 30, 2016

---

# Require Once / Include

 *  [quincyadam](https://wordpress.org/support/users/quincyadam/)
 * (@quincyadam)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/require-once-include/)
 * Hello:
 * I have set a $url in a setup.php file that lives in my /childtheme directory.
   When I use the code below, it doesn’t use the $url set from my setup.php, but
   from the existing page. If I hardcode my original script for the button on a 
   template level, it works fine, but I would prefer to use this method, since I
   would have more flexibility in adding the button to specific regions. Is there
   a way to include my setup.php on the plugin, so it’s pulling from the setup.php
   vs. echoing the current URL? Is there another suggested method?
 * <div class=”button”>[Ready to get started? Click Here.](https://wordpress.org/support/topic/require-once-include/[insert_php]echo $url;[/insert_php]?output_format=md)
 * Thanks!
 * [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)

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

 *  Thread Starter [quincyadam](https://wordpress.org/support/users/quincyadam/)
 * (@quincyadam)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/require-once-include/#post-6308390)
 * Forgot to put code between backticks. Here it is:
 * `<div class="button"><a href="[insert_php]echo $url;[/insert_php]">Ready to get
   started? Click Here.</a></div>`
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/require-once-include/#post-6308554)
 * Hi Quincy,
 * As you have it now, the value of $url is null. So you end up with `<a href=""
   >Ready to get started? Click Here.</a>`
 * See [http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#inandofitself](http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#inandofitself)
 * Something like this might work for you:
 *     ```
       <div class="button">
       [insert_php]
       include($_SERVER['DOCUMENT_ROOT'].'/childtheme/setup.php');
       echo "<a href='$url'>Ready to get started? Click Here.</a>";
       [/insert_php]
       </div>
       ```
   
 * Will
 *  [Shaz3e](https://wordpress.org/support/users/shaz3e/)
 * (@shaz3e)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/require-once-include/#post-6308761)
 * In my case I want to include a file it doesn’t work
 * `[insert_php]include(TEMPLATEPATH . "/inc-pages/main.php");[/insert_php]`
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/require-once-include/#post-6308763)
 * Shaz3e, start a new thread.
 * And describe what it doesn’t do that you think it should or what it does that
   you think it shouldn’t. “It doesn’t work” tells me nothing I can work with.
 * I will not support new issues on old threads.
 * Will

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

The topic ‘Require Once / Include’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3475630)
 * [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/)

## Tags

 * [plugin modification](https://wordpress.org/support/topic-tag/plugin-modification/)
 * [require once](https://wordpress.org/support/topic-tag/require-once/)

 * 4 replies
 * 3 participants
 * Last reply from: [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/require-once-include/#post-6308763)
 * Status: not resolved