From the Blogabout me

Contact Form 7 Confirmation Message Tip

Do you use Contact Form 7 for WordPress? If so, this quick tip will be helpful for you.

A number of my clients as for customizations and tweaks to be done to the plugin to make it function a little differently than the default, but there is one customization that is hidden but anybody can do.

Success Message Position

Many of my clients who use Contact Form 7 ask about the success message. So if you have ever wanted to move the Contact Form 7 Confirmation Message from the bottom of the form to anywhere else on the form, it may be much easier than you think. Just add the
[response]
shortcode to your form where you want it to display.

Let’s just say you have a form that requests First Name, Last Name, Email Address, and a standard Text Box. A form like that, will look something like this:

Generic Contact Form 7 Form

And your backend Contact Form 7 form settings and layout would look something like this:

<p>First Name (required)<br />
[text* first-name placeholder"First Name"] </p>
<p>Last Name (required)<br />
[text* last-name placeholder"Last Name"] </p>
<p>Email Address (required)<br />
[email* your-email placeholder"user@domain.com"] </p>
<p>Message (required)<br />
[textarea* your-message] </p>
<p>[submit "Send"]</p>

Good so far? Now if you were to click send right now you would get a little confirmation message on the screen that says something generic and it would be at the bottom of the form:

Generic Standard Contact Form 7 Message

This is pretty and everything, but we have a problem… Maybe your form is too long or you think your visitors will not see the confirmation… Now what?


The fix:

There is a built-in feature that is not shared by the developer very well, but is very useful. Simply add in the shortcode [response] wherever you would like the success message to be displayed after clicking Send and it will display there.

<p>[response]</p>

<p>First Name (required)<br />
[text* first-name placeholder"First Name"] </p>
<p>Last Name (required)<br />
[text* last-name placeholder"Last Name"] </p>
<p>Email Address (required)<br />
[email* your-email placeholder"user@domain.com"] </p>
<p>Message (required)<br />
[textarea* your-message] </p>
<p>[submit "Send"]</p>

The Success Message is going to be at the very top of the form now

New placement of Contact Form 7 Success Message

Meta Refresh vs 301 redirects (.htacess) ?

Lots of people ask me what the difference between using the Meta Refresh tag verses using the .htaccess 301 redirect function is, so I am here to explain their differences.

So what is the Meta Refresh Tag?

Mostly people want to use this in the <head> section of their webpage to redirect to a different page/site.  For instance, let’s say you had a page that once lived at domain.com/awesome.html but now it is actually located at domain.com/pretty-cool.php.  It may be hard to reach out to all of your visitors, or you have a great search ranking you don’t want to mess up.  You can go into your old page file and add something like this:


<head>
<meta http-equiv="refresh" content="0;'http://domain.com/pretty-cool.php'" />
</head>


This now lets your visitor go straight to the new location without them having to think.  So far so good, right?  Not exactly…

Biggest problem with Meta Refresh is lots of sites use this method to redirect you to rogue or completely different sites.  You probably don’t want your visitors, or Google, thinking you are trying to send your visitors to some completely different place.  You can do this for a short period of time as a bandaid, but I definitely would not recommend it for a long period of time.

So, what do you do instead?



301 Redirect

This is to tell your site, users, and Google you are permanently changing the location of the page.  Most importantly it tells all search engines “hey, the website or page has moved – please don’t hurt me, just look over here now.”

How to do a 301 Redirect is pretty simple.

Open your .htaccess file (or create one) found in your root directory and add a new line:
Redirect 301 http://domain.com/awesome.html http://domain.com/pretty-cool.php
If you want to redirect entire site to a new site, and not just files, you can do this:
Redirect 301 / http://domain2.com/
Save the .htaccess file, make sure it’s on your site, and you are done.

 

Different types of Redirects:

301 = permanent

302 = temporary

 

Inserting shortcode into ANY template…

Do you have a great plugin that you use all of the time, but wish you could put it in a very custom location, maybe on the index.php or footer.php page of your template, instead of just a Post or Page?

Luckily there is a very simple way to do this…

Instead of just using [your shortcode info], you will want to go to your location of your template,
and change it to <?php echo do_shortcode( [your shortcode info] ) ?>

 

Sounds easily enough, huh?

 

Let’s look at an example I recently used was for the wpaudio plugin. I wanted to put near the bottom of just my index.php page, and not on any Post/Page within the site.

Step #1
To keep it simple, I went to Add New Post, added a MP3 file using the standard Upload/Insert >> Add Audio icon, selected my MP3 file and said Insert Into Post.

The Post then had this piece of code:

Step #2
So, I then copied this into Notepad, and slightly edited the code to look like this:

<?php echo do_shortcode(‘‘); ?>

 

Step #3
I pasted this code into my index.php file, and was good to go.