1012 posts
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Egypt
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
+1 more
wizylabs says
Ivor, is there anywhere in your theme the option ivor_contact_email is inserted into the database? like somewhere in your theme options that adds the ivor_contact_email option on the form submit ? using update_option('ivor_contact_email', 'example@example.com'); or add_option('ivor_contact_email', 'example@example.com');
I’m adding the email via the admin panel :)
$options[] = array(    "name" => "Contact Email",
        "desc" => "Enter your email for the contact page (i.e. example[at]email.com)",
        "id" => $shortname."_contact_email",
        "std" => "",
        "type" => "text");    

I think I caught the problem. The contact-form.php file is reached only by the contact form as its action, therefore you need to include, somehow the wp-load.php from the wp main root without using any of the WordPress paths constants like ABSPATH or whatever in the contact-form.php for the wordpress functions to work.

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says

Hey Ivor,

require($_SERVER['DOCUMENT_ROOT'].'/path/to/wp-load.php' );

If it’s an external file, then you can call get_option(‘your_option’).

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says
require($_SERVER['DOCUMENT_ROOT'].'/path/to/wp-load.php' );

define("WEBMASTER_EMAIL", "get_option('ivor_contact_email')" )
1012 posts
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Egypt
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
+1 more
wizylabs says
require($_SERVER['DOCUMENT_ROOT'].'/path/to/wp-load.php' );

define("WEBMASTER_EMAIL", "get_option('ivor_contact_email')" )

Exactly what I meant :D

4317 posts ThemeForest Reviewer
  • Envato Staff
  • Reviewer
  • Community Moderator
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Venezuela
  • Has been a member for 5-6 years
  • Envato Studio (Microlancer) Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
+9 more
Ivor Reviewer says

Hey guys thanks a lot, I’m getting there :) wizy and vagrant sorry about another silly question but the contact file is inside the includes folder should I use this path? I got an error require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says
require($_SERVER['DOCUMENT_ROOT'].'/path/to/wp-load.php' );

define("WEBMASTER_EMAIL", "get_option('ivor_contact_email')" )
Exactly what I meant :D

;)

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says
Hey guys thanks a lot, I’m getting there :) wizy and vagrant sorry about another silly question but the contact file is inside the includes folder should I use this path? I got an error require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );

Its an absolute path, so you want to set the folder to where your wp install is on your server.

1012 posts
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Egypt
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
+1 more
wizylabs says
Hey guys thanks a lot, I’m getting there :) wizy and vagrant sorry about another silly question but the contact file is inside the includes folder should I use this path? I got an error require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );

say you theme includes folder found in wp-content/themes/YourTheme/includes

then use the below. there might be a better way to get the wordpress main root path instead of using tons of ../ :D
require( dirname(__FILE__) . '/../../../../wp-load.php' );
629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says
Hey guys thanks a lot, I’m getting there :) wizy and vagrant sorry about another silly question but the contact file is inside the includes folder should I use this path? I got an error require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );

say you theme includes folder found in wp-content/themes/YourTheme/includes

then use the below. there might be a better way to get the wordpress main root path instead of using tons of ../ :D
require( dirname(__FILE__) . '/../../../../wp-load.php' );

Nope, it has to be an absolute path with the code I posted. What you’re doing is trying to get a relative path.

1012 posts
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Egypt
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
+1 more
wizylabs says
Nope, it has to be an absolute path with the code I posted. What you’re doing is trying to get a relative path.

But that may cause an issue if wordpress is installed on a sub directory right? not sure though :D

by
by
by
by
by
by