• Stay in touch. Sign up for the 9seeds newsletter.
  • 6 Other Uses for Gravity Forms

    If you ask just about anybody who uses WordPress what their favorite plugin is for contact forms, they’re going to tell you it’s Gravity Forms. If you ask them why, they’ll tell you about how easy it is to set up a fairly complex form with radio buttons, dropdown lists, hidden fields and conditional logic. And they’re right. It easy to do those things. But, if you are only using Gravity Forms for contact forms, you’re only seeing the tip of the iceberg.

    Here are some other ways we’ve helped our clients while using Gravity Forms.

    1. Grow your mailing list
    add-to-mailinglist

    OK, this one is so simple, you’re going to kick yourself for not doing it a long time ago. Your site already has a contact form, right? Add a checkbox or radio button to the form that asks the question, “Can we add you to our mailing list?” If you use double opt-in for your mailing list, go ahead and default the answer to yes. Next, simply install the add-on plugin to connect your form to MailChimp, AWeber, Constant Contact, or whichever provider you use.

    2. Sell a product
    If you’re looking to build out a shopping cart with a bunch of products, this probably isn’t the answer. But If you have a single product that you’re looking to sell, Gravity Forms is up to the task. Grab the Paypal or Stripe add-on, add a product field to your form and you’ll be ready to start selling in minutes.

    3. Accept guest posts on your site

    guest-post
    Most times when sites tell you they’re looking for guest posters, they tell you to email your article to an editor. I feel sorry for the person who receives those entries. They’re having to do so much extra work. In Gravity Forms you simply need to use the Post Fields options. Add a Title and Body field to your form and then edit the title field’s settings. You’ll be able to mark the incoming posts as Drafts so they won’t be published until after you’ve approved them. If you want to get extra fancy you can also let the guest poster add an image that will be used as the Featured Image.

    You just made the process of accepting and processing guest posts drop-dead simple. Nice work!

    4. Add entries to a custom post type
    gf-event

    (This one is a little more advanced and is targeted more towards the developers in the room.)

    We’ve used this one for a number of clients. One that sticks out most was a client who said, “We’d like to let visitors submit upcoming events to display on our community calendar.” They already had a calendar plugin that used custom post types, so we only needed to create a form that had the proper fields, then use the Gravity Forms + Custom Post Types plugin to sync up the fields. The plugin lets you mark the incoming entries as drafts, making it easy for you to double-check the entries for bogus information before hitting publish. Bingo, you are now crowd sourcing your content!

    5. Connect. To. EVERYTHING.

    gf-to-zap

    This one could probably be a post all by itself. Have you ever heard of zapier.com? Zapier is a service that helps to connect services with other services based on actions being taken. For instance, you can use it to create an entry in Evernote each time somebody fills out a form on your site. Or post to Twitter, or ping you in HipChat, create a document in google Drive, post to Facebook, add files to Dropbox, create a record in Campfire, make a note in Basecamp or Asana… or one of another 100 or so things.

    The setup process for getting Zapier to work with Gravity Forms takes a little doing. I implore you to not assume anything and read the instructions as they’re given. Do one thing out of order and you’re starting over. Grab this add-on and get started.

    While it may be a little tricky to get set up, once you start automating, you’re going to want to automate even more.

    6. Build custom solutions
    gf-custom

    You’ve probably guessed that this one is on the advanced side, but I think it’s too important not to include.

    Event Central was a client who needed a shopping cart that wasn’t a shopping cart. They wanted to give clients the ability to shop like they were about to make a purchase, but instead of a checkout page, they end up at a Gravity Form. We collect a bunch of information about the event and then we use the Gravity Forms hooks & filters to pull in the products that the customer added to their shopping cart. All this information gets stored just like a standard Gravity Form and gets emailed to the appropriate person.

    This scenario is pretty specific, but that’s not important. What IS important is looking at Gravity Forms for all the things that it can do for you that might require a lot of extra work if you had to build it yourself. Data validation, storing the entries in an easy to use format, automated email responses, etc. All that is already built in to Gravity Forms, you simply need to tap in to it.

    Just the beginning

    Gravity Forms is one of the most powerful, most flexible WordPress plugins you’ll find. Our list of 6 uses still barely scratches the surface of everything you can do with it. If you have a custom use for Gravity Forms that you want to share, drop it in the comments. We’d love to hear about it!

     

    Time Tracker version 1.5.2

    I was surprised to see that it had been more than 3 months since the last time I wrote about Time Tracker. That’s a shame because there’s been a lot going on with the plugin. Since last I wrote we’ve released 5 updates with a whole bunch of new functionality. Here’s a list of what’s new in Time Tracker.

    • Create/save invoice for hours worked
    • View/delete past invoices
    • New tabbed settings page
    • Option to send an email to site admin when new hours are entered by contractors
    • Option to display all projects to contractors (rather than on a case-by-case basis)
    • Summary of hours by contractor on ‘Create Invoice’ page
    • Default projects created when new clients are added

    We’ve been getting some great feedback from our users and we’ve got a number of features in the works. If you’ve got a feature you’re looking for, let us know and we’ll get it on the list.

    And if you haven’t done so already, purchase your license here.

    End of Life for Event Ticketing

    It started with a question. I asked Justin, “Are you still excited about working on Event Ticketing?” He didn’t even have to answer. When it took him more than 2 seconds to answer, I knew he was looking for the right way to let me down easy.

    We spent the next 30 minutes talking about it, trying to rationalize keeping the plugin around. But ultimately, I explained it like this: “At the moment, the Event Ticketing plugin is a mediocre product. Since you are the person doing 90% of the development, if you aren’t excited about the project, there is no way we will ever make the plugin anything other than mediocre.”

    And with that, be both knew what we had to do.

    Today we are announcing the End of Life of both:

    - WP Event Ticketing (version 1.3.3)
    - Event Ticketing for WP (version 2.0.1)

    We did not make this decision lightly. It’s actually been on my mind for the past couple months. But after an increase in support requests starting coming in and the realization that it could be weeks or even months before we could get a couple key issues fixed, the writing was on the wall and I knew it was time to pull the plug.

    If you’re a developer and you would like to pick up where we left off and get Event Ticketing ready for prime time, the code can be found on github.

    Genesis Simple Headers

    And while we’re killing of plugins, he have also decided to remove Genesis Simple Headers from the WordPress repo.

    This plugin was something I wrote quickly to serve a very narrow purpose. I released it thinking “hey, maybe this will be useful for a couple people.” Then it was downloaded more than 30,000 times. Yikes!

    We finally decided to remove it thanks to two key factors;
    a) StudioPress started adding the header functionality to the bulk of their new themes
    b) With the release of Genesis 2.0, it would take a sizable amount of work to make GSH compatible

    With less themes needing our plugin, spending the time to fix the plugin’s issues just seems silly. So by having the plugin available in the repo, we’re causing frustration for new users.

    What about current users?

    If you’re currently using one of the plugins above without issue, our decision to stop development will not affect you immediately. Your current plugin will not automatically cease to function. However, as WordPress continues to release new versions, there is no guarantee that the plugin will continue to function and you may need to seek an alternative solution.

    Pretty PHP Date Ranges

    Pretty PHP Date Ranges

    Last week I needed to come up with a way to display a pretty date range based on a starting and ending date in PHP. It’s simple enough use PHP’s date function to convert a unix timestamp into a pretty date format, but PHP doesn’t have a built in function to format date ranges.

    The goal was to take two unix time stamps and output a range that looks like this:

    January 25 – 26th, 2014

    This sounds and is simple until you take into account that sometimes it crosses months and needs to look like this:

    January 25 – February 2nd, 2014

    or could cross years like this:

    December 25th, 2013 – January 3rd, 2014

    So here is the code to build those prettified date ranges:

    <?php 
    /**
     * Verbose Beautified Date Range
     *
     * @access public
     * @param mixed $start_date
     * @param mixed $end_date
     * @return $date_range (beautified date range)
     *
     * @author Jon Brown <jb@9seeds.com---->
     * @since 1.0
     */
     
    function jb_verbose_date_range($start_date = '',$end_date = '') {
     
        $date_range = '';
     
        // If only one date, or dates are the same set to FULL verbose date
        if ( empty($start_date) || empty($end_date) || ( date('FjY',$start_date) == date('FjY',$end_date) ) ) { // FjY == accounts for same day, different time
            $start_date_pretty = date( 'F jS, Y', $start_date );
            $end_date_pretty = date( 'F jS, Y', $end_date );
        } else {
             // Setup basic dates
            $start_date_pretty = date( 'F j', $start_date );
            $end_date_pretty = date( 'jS, Y', $end_date );
            // If years differ add suffix and year to start_date
            if ( date('Y',$start_date) != date('Y',$end_date) ) {
                $start_date_pretty .= date( 'S, Y', $start_date );
            }
     
            // If months differ add suffix and year to end_date
            if ( date('F',$start_date) != date('F',$end_date) ) {
                $end_date_pretty = date( 'F ', $end_date) . $end_date_pretty;
            }
        }
     
        // build date_range return string
        if( ! empty( $start_date ) ) {
              $date_range .= $start_date_pretty;
        }
     
        // check if there is an end date and append if not identical
        if( ! empty( $end_date ) ) {
            if( $end_date_pretty != $start_date_pretty ) {
                  $date_range .= ' - ' . $end_date_pretty;
              }
         }
        return $date_range;
    }

    To actually use that in WordPress you’d just add something like this in your template file where you wanted to output the date, here based on two custom field values.

    <?php 
    $start_date = get_post_meta( get_the_ID(), 'jb_start_timestamp', true );
    $end_date = get_post_meta( get_the_ID(), 'jb_end_timestamp', true );
     
    if ( (!empty($start_date)) || (!empty($end_date)) ) {
         echo '<span class="pretty-date-range"---->';
         echo jb_verbose_date_range( $start_date , $end_date );
         echo '<!-- pretty-date-range -->';
    }

    Sticky Footer for Genesis

    glue-bottleWe had a client request that their site’s footer be fixed to the bottom of the browser window for “short pages” or pages with little content. A good example of how to accomplish this with HTML and CSS is available at: http://css-tricks.com/snippets/css/sticky-footer/. If you’re using the Genesis framework for WordPress however, a couple more steps are required to get the sticky footer working.

    For this example, we’re using the Genesis sample theme, but it should work for any theme available from StudioPress with minor CSS adjustments to .site-footer height and .page-wrap margin-bottom.

    You’ll only need to work with two files: functions.php and style.css. The code for each section is listed below. Note that this solution will likely not work in IE8 or Opera, where a javascript solution may be needed (see Ryan Fait’s sticky footer example for an alternative method that is not Genesis-specific).

    Your mileage may vary. Feel free to leave your modifications and suggestions in the comments.

    Sticky footer for genesis screenshot

    Functions.php

    //* Sticky Footer Functions
    add_action( 'genesis_before_header', 'stickyfoot_wrap_begin');
    function stickyfoot_wrap_begin() {
    	echo '<div class="page-wrap">';
    }
     
    add_action( 'genesis_before_footer', 'stickyfoot_wrap_end');
    function stickyfoot_wrap_end() {
    	echo '</div><!-- page-wrap -->';
    }

    style.css

    html, body {
    	height: 100%;
    }
     
    .site-container {
    	height: 100%;
    }
     
    .page-wrap {
    	min-height: 100%;
    	/* equal to footer height */
    	margin-bottom: -90px; 
     
    }
     
    .site-inner {
    	min-height: 100%;
    	/* equal to footer height */
    	margin-bottom: -90px; 
    }
     
    .site-footer, .site-inner:after {
    	/* .site-footer and .site-inner:after must be same height as .site-inner */
    	height: 90px; 
     
    }
     
    .site-footer {
    	background: orange;
    	/* Use this for testing */
    }