Gravity Forms – 5 Digit Zip Codes & State Abbreviations

Originally based on the code by Matthew Connerton on the Gravity Forms support site, I have modified his original code to also trim the zip code into the first 5 digits. Currently with Gravity Forms, there is no (easy) way to change the input fields to only accept 5 digits (or any other number) and/or change the submitted state selection to their USPS equivalents. If you're trying to use your data to generate mailing labels or anything similar, the way it is setup can be messy and/or problematic. Hence, the solution Mr. Connerton, and now myself, have developed. It is written as a plugin so all you have to do is download the file below, unzip it and put it in your WordPress plugins folder. It will then modify the submitted entry prior to it being saved to your database, and BAM! You're a happy camper. So what does this plugin do in short? -

  • Trim submitted zip codes to 5 digits
  • Convert full state names to their USPS state abbreviations
Enjoy! > State and Zip Code Modifier for Gravity Forms (2088) Note: the link to Gravity Forms only works if you're logged in to their support forums.

Weather Underground Plugin Expansion

My favorite Denver SEO company Katz Web Services announced the release of their latest awesome plugin- WP Wunderground Plugin. It's a well done, awesome plugin that allows you to use short codes to display the weather forecast in a widget or blog post. For one of my clients however, we wanted the weather to be a part of the theme outside of a widget. A small bit of code later, it's done. You can see the weather forecast for Roanoke, VA by clicking that link. We installed the WP Wunderground Plugin and then added this bit of code to our theme file: 1 Now, an explanation of what you see. Line 2 is a conditional statement checking to see if the plugin is currently active by checking to see if the plugin's class exists. It wouldn't exist if the plugin was active. You could also use the WordPress function is_plugin_active() but I've run into a couple of instances where it returns an unknown function error. Lines 3 & 6 are simply creating a container «div» for styling purposes. Lines 4 creates a new instance of the plugin class and Line 5 prints the result of the internal method build_forecast(). The '24012' is the zip code I want the weather returned for and is also defined in the plugin settings. Enjoy!

Get Your WordPress Multisite Blog Slug

I chose this subject to write about for two reasons. One: I'm sure there are folks out there who will find this useful. And Two: I can never remember it myself so by writing about it here, I won't have to remember, I can just refer back to my own blog! Often, when using WordPress multisite as a content management system rather than a blog network, I have the need to use a blog slug in image paths, or when doing DB queries or whatever. There are lots of reasons, but here's how you get it > 1 I find the $GLOBALS variable to be really useful. If you'd like to see all the stuff you can get out of there, just drop this line in your theme somewhere (it's quite long, so best not to do it on a production site)- 1 Enjoy!

    • Marty has been an active search marketing professional for over 12 years. He has consulted with the Fortune 100 and Fortune 500 as well as medium to small B2B and B2c businesses, governments and higher ed.