Technology WordPress Tips & Tricks

How to Add Images to Customize Contact Form 7 on WordPress

Contact Form 7 is flexible, but adding images takes a little extra work. Here is how to add and customize images in Contact Form 7, so your forms look the part instead of feeling like a plain afterthought.

Namrata Namrata 3 min read

 

Contact Form 7 customization
Contact Form 7 Customization

 

The Contact Form 7 is the most downloaded and used plugin to create forms. The plugin can be used to create simple forms dynamically using several tags offered like Text field, Email, Checkboxes, Date, etc. These tags are predefined. But let’s say you would want to add some element of your own apart from what the form provides, for example an image or your company logo.

You could probably create your own custom tag, but this would be a lengthy process and not all of us are coding experts to achieve this easily. Explained below is a method to achieve this using simple HTML code which anybody can use. Not only can we use it to add an image but we can extend the idea to add any other field such as a table or footnotes if desired. Do note that this solution is to make a change only for an individual form.

[space]

Insert an image into Contact Form 7

Lets us take a use case to add a company logo in the comments form. Our form would contain fields for name, email, comments, the logo (which we would want to display) and a submit button. The logo would be some file ‘abc_logo.png’.

The first thing you would want to do is to upload the logo file (if not present already) in the media files from the dashboard. This provides us with the path for the file which we will be using to display the logo.

Our code for the form would have to look something like this:

<p>Your Name (required)<br/>
[text* your-name] </p>

<p>Your Email (required)<br/>
[email* your-email] </p>

<p>Your Comments<br/>
[textarea comments x4] </p>

<!-- add company logo -->
<div >
<!-- specify the url path for the image -->
<img src="http://localhost/wordpress/wp-content/uploads/2014/01/abc_logo.png">
<br/>
</div>

<p>[submit "Send"]</p>

If we were to add the form to a page, the output would be:

contact-form-7-with-logo
Contact Form 7 with a Logo

Similarly we can add any WordPress UI element using simple HTML code. Just add the corresponding HTML code for the desired element in place of the image tag. It could be a simple link, an image link, maybe a table or a customized button. This code could be placed anywhere in your form. This is a much neater and design friendly solution than changing the core code of the plugin. Be sure to leave comments if you have any further questions or suggestions for a better way of achieving the same.

Get a FREE Consultation

Let's build something that lasts.

Share what's on your mind — a clear brief, a half-formed idea, or just a sense that something needs to change. We'll listen first, ask the right questions, and point you toward what's actually worth building.

We take on a handful of projects each quarter,ones where we can truly make a difference.

  • Receive a human response within 24 hours
  • Get a detailed scope and quote upfront
  • We're happy to sign an NDA upon request

    Free 30-Min Strategy Call

    Your Name *

    Your Phone No *

    Work Email *

    Your Budget*

    Project Details *