Display Gravity Forms Poll Results With Wordpress Shortcode

  • Posted on: 8 January 2015
  • By: davis

Gravity Forms does not come with an easy mechanism for displaying poll/survey results independently of user actions. This seems to be a pretty big oversight. 

I was trying to put up a post that showed the results of a previous poll, but found no way to simply display the results to users. Gravity Forms Polls usually only display the result post-survey, or via a "View results" link.

Since polls are essentially user-generated content, it was critical to me that I could display results (encourage visitors to debate the results and guide them to another poll).

I found Gravity View, which is a third-party plugin that promises to cull that information and display it beautifully. Unfortunately, it's not free, and their demo feature is broken.

Here's my shortcode solution, after much digging and experimentation:

[gravityform action="polls" id="5" mode="results" style="green" cookie="1 month" show_results_link="true" display_results="true" percentages="true" counts="true"]

This shortcode displays the Gravity Form poll results for poll id="5". You will need to adjust this for your poll's number, of course.

For those interested in digging deeper than a shortcode, here's some helpful information.

A Gravity Forms developer also posted useful experimental code on pastebin:

For those looking to incorporate the shortcode in their theme, try the following: