Title: Calling functions
Last modified: August 18, 2016

---

# Calling functions

 *  Resolved [darrenalawi](https://wordpress.org/support/users/darrenalawi/)
 * (@darrenalawi)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/calling-functions/)
 * How can I call a function that is “undefined”?
 * I have created a custom error message for when users do not enter required info
   into the comment form (try it here if you want, just hit enter with the field
   empty: [http://www.darrenalawi.com/blog/index.php/google-vs-apple/](http://www.darrenalawi.com/blog/index.php/google-vs-apple/))
 * The message appears as part of a small hack, and is just XHTML from:
 * [http://www.darrenalawi.com/wordpress/wp-content/themes/darrenalawi/error.php](http://www.darrenalawi.com/wordpress/wp-content/themes/darrenalawi/error.php)
 * What I want to do is replace the XHTML for the header, sidebar and footer with
   call functions like:
 * <?php get_header(); ?>
    <?php get_sidebar(); ?> <?php get_footer(); ?>
 * But whenever I swap out the XHTML in the error.php file for any of these calls,
   and load the page (by submtting incorrect form) I get:
 * Fatal error: Call to undefined function: get_header() in e:\domains\d\darrenalawi.
   com\user\htdocs\wordpress\wp-content\themes\darrenalawi\error.php on line 1
 * etc…
 * Can anyone enlighten me?

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

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/calling-functions/#post-646788)
 * In general you cannot just add a new template to your theme which falls outside
   the [template hierarchy](http://codex.wordpress.org/Template_Hierarchy) and expect
   WordPress to know about it (or for it to know about WordPress). To make such 
   a PHP document WP-aware, you need to first include the wp-blog-header.php file,
   which is discussed here:
 * [http://codex.wordpress.org/Creating_a_Static_Front_Page#Integrating_WordPress](http://codex.wordpress.org/Creating_a_Static_Front_Page#Integrating_WordPress)
 *  Thread Starter [darrenalawi](https://wordpress.org/support/users/darrenalawi/)
 * (@darrenalawi)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/calling-functions/#post-646794)
 * Hi Kafkaesqui,
 * Thanks for the quick response, great advice. I added the code to the top of the
   file and now get this message:
 * Warning: main(./wordpress/wp-blog-header.php) [function.main]: failed to open
   stream: No such file or directory in e:\domains\d\darrenalawi.com\user\htdocs\
   wordpress\wp-content\themes\darrenalawi\error.php on line 3
 * Fatal error: main() [function.require]: Failed opening required ‘./wordpress/
   wp-blog-header.php’ (include_path=’.;c:\php4\pear’) in e:\domains\d\darrenalawi.
   com\user\htdocs\wordpress\wp-content\themes\darrenalawi\error.php on line 3
 * I assume this is because the php file I inserted this code into isn’t in the 
   root of the domain?
 * Can you offer any more of your expertise?
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/calling-functions/#post-646798)
 * The `require` line would need to point to the location of wp-blog-header.php 
   in your WordPress installation. The path provided on the Codex page is just an
   example.
 * You can try using the full path the error noted:
 * `require('e:\domains\d\darrenalawi.com\user\htdocs\wordpress\wp-blog-header.php');`
 *  Thread Starter [darrenalawi](https://wordpress.org/support/users/darrenalawi/)
 * (@darrenalawi)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/calling-functions/#post-646854)
 * Hi Kafkaesqui,
 * Thats great and it worked as well!! Thanks for your help.
 * Darren.

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

The topic ‘Calling functions’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [darrenalawi](https://wordpress.org/support/users/darrenalawi/)
 * Last activity: [18 years, 9 months ago](https://wordpress.org/support/topic/calling-functions/#post-646854)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
