0

I've been using a child theme for many years now. In the function.php of the main theme there was an option page where you could put in your e-mail address for the contact form.

I'm currently cleaning up my function.php and I'm not using the original theme's option page at all. I was able to get rid of everything except the contact form bit, because the contact form would stop working.

I'll expalin in detail:

In the contact.php I wanted to replace this:

<input type="hidden" id="receiver" name="receiver" value="<?php echo strhex(get_option('alltuts_contact_email'))?>"/>

With this:

<input type="hidden" id="receiver" name="receiver" value="myemail@address.com"/>

You'd think that should work, but it doesn't.

When I go to the contact form and hit the "send" button I get the following error message: "Your email failed. Try again later."

I played around a bit with the code. I tried to remove everything concerning the theme's option page in the function.php but it either didn't work or broke my theme.

Here are all the files that have to do with the contact form:

contact.php: http://pastebin.com/56yvK7Ae

sendmail.php: http://pastebin.com/MuqByBZE

function.php (the theme option code and the contact form code are both at the very end): http://pastebin.com/9HMUkt8d

I'm really bad with code in general, but I suspect it has something to do with the code in the sendmail.php.

Of course, everything works great the way it is, but there's so much code I could toss if only the replacing with my e-mail address would work ...

I hope somebody can help me figure out why it won't work.

Thank you so much in advance! :D

  • Notice the call to strhex in the original – Tom J Nowell May 22 '15 at 12:11
  • @TomJNowell Sorry, like I said, I'm quite bad with code. Could you elaborate a bit, please? – japanworm May 22 '15 at 12:14
  • The value isn't being outputted, it's getting passed through the strhex function first. Your edited version doesn't do this, so obviously strhex is doing something important – Tom J Nowell May 22 '15 at 16:27
  • @TomJNowell Ok, so my assumption that the bit of code at the very end of my function.php has something to do with it was right. Now I need to figure out how I can edit all the files to make the contact form work without this workaround. – japanworm May 22 '15 at 21:44
  • Or you could pass in your email into that function? echo strhex( "this is a string" ) – Tom J Nowell May 25 '15 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.