Craig Ralston

Web Developer

Add New Fields to WooCommerce Checkout Form

Start by adding a new field to the billing checkout form

I end up with a new input field that looks like:

Now, we need to save the value of that field to the user_meta table, like so:

Now that data is stored in user_meta, we need to hook in to the profile area to display it and allow it to be edited by the user or admins.

I chose to break my additional fields into their own table just above the default Woocommerce fields as I have many of them and they are more specific to the user rather than the order processing itself, so I keep them organized in their own table titled “Additional Fields”.

Responsive iframes

This quick guide will show you how to make your embedded iframe fully responsive.

Start by wrapping your iframe in a div and assign a class.

Though the iframe has a set width, you can use CSS positioning properties to force the element to adapt to the size of your wrapper, which will use percentages and remain responsive down to mobile.


WordPress 4.2 Released

So, I am about a week behind on this post as 4.2 has already been released (and 4.2.1, for that matter) but, hey, better late than never right?

As is tradition with WordPress major releases, this version has been named after Jazz musician “Bud Powell” and comes loaded with cool stuff, from enhanced character sets (yes, this now allows for Emoji support ) to streamlined “Shiny” plugin updates. Press This and the Customizer have also made some serious progress as well as additional embed support for Tumblr and Kickstarter embeds.

Take a look at the Core blog post outlining the new features and be sure to watch the video!

You may also see a familiar name down there in the credits for contributing to the 4.2 release.

Contact Form 7 – “Send me a copy” Checkbox

UPDATE: The following code no longer works as of CF7 v3.9 as the author has changed how wpcf7_before_send_mail() works. Here is an updated guide for v3.9+ written by Max Pohlenz

Contact Form 7 is a highly customizable and widely used WordPress plugin (at the time of writing there have been 24,137,767 downloads); We currently have 67 of our 98 WordPress sites with this plugin installed.

I recently had a client request a checkbox field for “Send me a copy of this message” which, when checked, should send the user their own copy of the form submission. This is not an entirely uncommon request and luckily, CF7 is pretty well-developed and allows developers to extend the plugin via filters.

The following shows the end result; a checkbox in which the user can choose to send a copy of the form to themselves as well as the set recipient:

Add that as either a plugin or in your child theme functions.php file.

Next, load up your form in the admin area.

Create your checkbox using [checkbox copymyself "Send me a copy of this message"] – It is important you use the same name as you checked for in the function above (in this case, “copymyself”) or this will not work.

IMPORTANT: Mail(2) needs to be turned on in CF7 settings area.