Title: include templatepath function
Last modified: August 19, 2016

---

# include templatepath function

 *  Resolved [ronchicago](https://wordpress.org/support/users/ronchicago/)
 * (@ronchicago)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/include-templatepath-function/)
 * 1) this is the code to get an alternate header =
 * > <?php include (TEMPLATEPATH . ‘/header2.php’); ?>
 * 2) i moved a file outside of the wp directory and that file is now looking for
   header2.
 * i tried this but it does not work =
 * > <?php include (TEMPLATEPATH . ‘[http://www.domain.com/wp-content/themes/theme/header2.php&#8217](http://www.domain.com/wp-content/themes/theme/header2.php&#8217););?
   > >

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

 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/include-templatepath-function/#post-957396)
 * TEMPLATEPATH is the template URL ([http://www.domain.com/wp-content/themes/theme](http://www.domain.com/wp-content/themes/theme))
   and the period is concatenation, which means that the template URL is added to
   whatever follows it.
 *  Thread Starter [ronchicago](https://wordpress.org/support/users/ronchicago/)
 * (@ronchicago)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/include-templatepath-function/#post-957399)
 * i understand the function and concatenation. it would seem an absolute path would
   find the header.php but then, again, maybe i don’t understand.
 * i get these error codes, i.e., can’t find header2.php
 * > Warning: main(TEMPLATEPATH/header2.php) [function.main]: failed to open stream:
   > No such file or directory in /home/code/public_html/enter.php on line 18
   > Warning: main() [function.include]: Failed opening ‘TEMPLATEPATH/header2.php’
   > for inclusion (include_path=’.:/usr/php4/lib/php:/usr/local/php4/lib/php’) 
   > in /home/code/public_html/enter.php on line 18
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/include-templatepath-function/#post-957402)
 * TEMPLATEPATH is a special WordPress function, so it can only be used _within_
   WordPress. Try a regular php include instead.
 *  Thread Starter [ronchicago](https://wordpress.org/support/users/ronchicago/)
 * (@ronchicago)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/include-templatepath-function/#post-957618)
 * tried it both ways – both in and out of wp – and moved the file back inside wp,
   though in the wp root and the wp-contents.
 * thanks iridiax
 *  [drmanry](https://wordpress.org/support/users/drmanry/)
 * (@drmanry)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/include-templatepath-function/#post-957619)
 * ronchicago,
 * Since you’re supplying an absolute path, just use
    `<?php include ('http://www.
   domain.com/wp-content/themes/theme/header2.php'); ?>`

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

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

## Tags

 * [templatepath](https://wordpress.org/support/topic-tag/templatepath/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [drmanry](https://wordpress.org/support/users/drmanry/)
 * Last activity: [17 years, 4 months ago](https://wordpress.org/support/topic/include-templatepath-function/#post-957619)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
