title: Wordpress - How to include() a file that lies in another dir
body: <p>I am writing a plugin that will take advantage of other plugin's features (think about a plugin for a plugin).</p>
  
  <p>My file lies in /plugins/new-plugin/new-plugin.php</p>
  
  <p>and I need to make a
  <code>include(/plugins/OLD_plugin/old-plugin.php)</code>
  so I can use a couple of functions from the old-plugin.php file.</p>
  
  <p>What is the correct way to do this? I could maybe make the functions in old-plugin.php available globally, but I don't want to change the old-plugin.php file.</p>
  
  <p>I've already tried several ways to do this, but none worked. The new-plugin will only show some info in an options page, not viewable for the general public and does not interact with any public page or post in my site.</p>
  
  <p>I've already tried $_SERVER, WP_PLUGIN_DIR, WP_CONTENT_DIR, the absolute server path, relative paths and even some black magic, but nothing seems to work good.</p>
  
  <p>With some of this solutions the plugin's options page shows good but the blog's pages do not render. With other solutions the inverse happens, and with some other solutions nothing even render, be it admin pages or blog's pages, all with errors regarding to file not found.</p>
  
  <p>The new-plugin.php is as simple as</p>
  
  <pre><code>&lt;?php
  /*
  WP Common Headers
  */
  
  global $wpdb;
  if ( ! defined( 'WP_CONTENT_DIR' ) )
         define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
  if ( ! defined( 'WP_PLUGIN_DIR' ) )
         define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
  
  include '/server-absolute-path/public_html/gameblogs/wp-content/plugins/old-plugin/old-plugin.php';
  
  add_action('admin_menu', 'new_plugin_menu');
  
  function new_plugin_menu() {
  $page_title = 'New Plugin';
  $menu_title = 'New Plugin';
  $function = 'new_plugin_admin_page';
  $menu_slug = 'new_plugin';
  
  add_menu_page($page_title, $menu_title, 0, __FILE__, $function);
  }
  
  function new_plugin_admin_page() {
  
      $result = old_plugin_link_data(" WHERE link_destination NOT LIKE '/%' AND link_destination NOT LIKE '%gameblogs%'");
  
      $total = count($result);
      old_plugin_list_links($result, $total, FALSE, FALSE);
      */
      }
  ?&gt;
  </code></pre>
  
  <p>thanks for any ideas!</p>