views:

9

answers:

1

I'm trying to use a mailer in my WordPress theme, but I don't seem to be able to pull admin email from WordPress.

I have a mailer.php file in my theme folder and tried using get_bloginfo('admin_email') function but it doesn't work. I'm a PHP newbie, but I'm guessing the mailer.php file isn't "connected" to WordPress installation. I tried including it in the functions.php file, but it only caused my theme to go blank.

So my question is, how do I pull WordPress functions in files, that aren't theme files?

To answer Pekka's comment - I get an error: Fatal error: Call to undefined function get_bloginfo() in mailer.php on line 4

+1  A: 

Import WordPress's functions using

include "/path/to/your/wordpress/wp-blog-header.php";

After that, you will be able to call get_bloginfo().

Pekka
Worked like a charm. Thank you very much!
Justine