Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress How to Make a Website with WordPress Customizing WordPress Themes Customizing WordPress Theme Files

Marlon Oliveira
Marlon Oliveira
474 Points

Contact form in child theme

I copied the file from theme/mail/contact.php to theme-child/mail/contact.php, I made some changes, upload the file, but the site didn't show the changes. What I did wrong?

Thanks.

4 Answers

Marlon, without knowing your exact file structure it looks like you might need to edit the block below to reflect how many levels up wp-config.php is. It should be the same but I'm not sure since you hadn't mentioned if you had it working before changing the location, or if wp-config.php has been moved. Otherwise, you may be able to get some help through the theme's support forum.

P.S. I'm not a child theme expert but I'm thinking you could have left it in the default location since those are the core files.

include "../../../../wp-config.php";

Is there any way you could post the contents of the file or upload to Dropbox?

P.S. A lot of theme developers and users will go for something like Contact Form 7 or even the one within Jetpack. Most times your CSS gets inherited and both solutions constantly receive updates.

missgeekbunny
missgeekbunny
37,033 Points

Did you set a page to that? It probably is just a template page which means you need to go to the meta and set a page to that. Also with that kind of structure it sounds like you probably have to call that file to get it to come forward. Usually unless it's in the base directory it won't be used unless it's called or linked to in some way. And lastly I would probably try to steer away from it and go with a plugin like contact form 7 or gravity forms or something. Themes really shouldn't be touching the database and having a form built and usable on a page that isn't using a plugin somewhere is going against how themes should be used.

-note: major advocate of themes for how it looks plugins for how it works which is the same mentality that the theme review team on .org holds when reviewing.

Marlon Oliveira
Marlon Oliveira
474 Points

Dustin,

This is my form: https://www.dropbox.com/s/26ok89f8trccl2a/contact.php

bunnie,

This contact form came with a Premium Theme (Native Church).

Thanks for you help.