How to Create a Contact Author Form without a Plugin

On 26 Aug, 2011 By With 22 Comments

Recently, I’ve been asked to create a Contact Author Form in one of the sites I am working on. Honestly, I don’t know if it is really called Contact Author Form, I just thought about it lol! I thought there are plugins that can do that, but after spending an hour looking for the said plugin my luck totally run out. So I decided to create a custom contact form for the author, I found Cats Who Code tuts which is really helpful for creating a basic contact form.

If you wanted to display a list of authors in wordpress, I also created a tutorial about that.

Author Contact Form How to Create a Contact Author Form without a Plugin

Today I will show you how I achieve the Contact Author Form; this is helpful especially if you’re running a multi-author blog, and some readers might want to get in touch with your authors, also if you are the admin you might want to receive a copy of the email that the author will get.

The form should:

  • Form should be in the author page
  • Form should send a copy to the admin every time the author receives an email

First download the js file and paste the whole folder in your theme folder. It should be like this js/verify.js and then open and paste this on your header.php next to the stylesheet.

Here is the Contact form from Cats Who Code; I modify it a little bit so it’ll fit in our requirements.

The magic starts in this line of code

This will grab the admin email, admin can receive the email but what about the author?

With this one we will grab the author’s email. Because we have a different author on your blog, we need to set the get_author_meta(‘user_email’).

Just copy the code and name it Custom-contact.php, in your theme folder open author.php and Copy and Paste this code

to where ever you want the form to appear, and do the following.

Open your author.php and change

to

You just have to check the alignment / style of the form depending on your stylesheet.

Conclusion

I think using a Contact Author Form is useful for Corporate websites and multi-author blog that has a lot of emails coming, if you are planning to use this in your blog make sure that the author know that as an admin you’ll also receive a copy of the email.

What you do use to reach out to your authors? How do you help your readers reach their favorite authors? You can list them below in the comments.

Tags:

I design / build Custom Wordpress Themes for different kinds of Clients, big or small, solo-prenuers or marketer. I've also worked with different design agencies as their 'web guy' for their Clients. I also enjoy writing tutorials and helping newbies so I can contribute to the community. Got a project in mind? Let's talk! | More about me?

22 Responses to “How to Create a Contact Author Form without a Plugin”