1012 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+6 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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
VagrantRadio says
require($_SERVER['DOCUMENT_ROOT'].'/path/to/wp-load.php' );

define("WEBMASTER_EMAIL", "get_option('ivor_contact_email')" )
1012 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+6 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

4336 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team 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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+6 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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more
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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+6 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