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 (3223) Note: the link to Gravity Forms only works if you're logged in to their support forums.

Events Manager Plugin – Hack to display events by categories

I have a client who uses the Events Manager plugin by Davide Benini and Marcus Skyes to manage events on their site. Unfortunately, the plug-in doesn't let you display events by category (which is weird, otherwise, why have the categories?) but anyway, I wrote/hacked together a custom function and WordPress shortcode today to display the events by category. Now, I know there are going to be the naysayers who say "This code isn't very pretty".  Yeah, well maybe not but it works.  And if you can improve on it, DO!  I'm totally open to it.  For instance, the edit I did makes more than one query to the DB which isn't optimal. Okay, so without further ado, here it is. Open up the file in your events-manager/ folder called 'marcus-extras.php'.  Around line 264 you'll find a function called dbem_get_category().  I added my custom function and shortcode right below it : 1 And then: 1 The shortcode is - [dbem_events_by_category] and you can just insert it into your post or page whereever you want it to go. By default it outputs ALL events under ALL categories but you could hack it up pretty easily to only display one category, etc. I may do that later if enough people ask for it but it's not what I needed so, didn't get done. :) Hope this helps some folks. Let me know if you have any questions!

    • 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.