The concept is pretty simple. Using Gravity Forms “Post Fields” you can create a form which generates a post when it is submitted. All you have to do is add the desired post fields to your form. When the form is submitted, Gravity Forms will check if any post fields exist on the form and if so, generate a fresh new post based on those post fields!
Before we get too much further into this, I’d really recommend checking out the basic Gravity Forms post creation demo. If you’re new to Gravity Forms this will give you a better idea of what to expect and some context for the rest of this tutorial.
Gravity Forms Post Features
This tutorial will cover each Post Field and some of the cool features each field has to offer. Here is a quick list of post-related functionality Gravity Forms can handle right out of the box:
- Set the Post Title
- Set the Post Body/Content
- Set the Post Excerpt
- Set the Post Category (GF v1.6.3 adds support for setting multiple categories!)
- Set Post Tags
- Upload Images to the Post Gallery
- Set the Featured Image (aka, “Post Thumbnail”)
- Create custom fields for the post
- Set the default Post Status (“Draft”, “Pending Review” or “Published”)
- Set the default Post Author
- Set the default Post Format (ie “Standard”, “Link”, “Gallery”, “Quote”, etc)
Not bad, huh? You can use this list to get more information on features that interest you OR if your thirst for Gravity Forms knowledge is simply unquenchable, I suggest reading from top to bottom.
1. Setting the Post Title
Adding a Post Title field to your form will allow the user submitting the form to specify the title of the post. The Post Title field is also where you will manage the default Post Status, Post Author and Post Format of the created post. We’ll go into each of those in more detail later.
One of the really neat features of the Post Title field is the ability to specify a “content template”. Enabling this option will allow you to use merge tags to populate the title with dynamic values. When might you want to do this? How about if you have a Post Category field on your form. When submitted, you want to append that selected category name before the submitted post title. Here’s how that might look:
Post Title Content Template Setting2. Setting the Post Body/Content
Adding a Post Body field to your form will allow the user submitting the form to specify the content of the post. Like the Post Title field, this field also provides options for managing the default Post Status, Post Author and Post Format of the created post.
Also like the Post Title field, the Post Body field provides the option to create a content template. It is with the Post Body field that the content template can really shine! The most obvious (and arguably the most useful) benefit is being able to insert submitted Post Images along side the submitted post content. I’ve implemented this functionality in the demo here. Here is the actual configuration I’m using to achieve the effect:
Post Body Content Template SettingYou’ll notice I’m using a pretty fancy merge tag to display the medium sized featured image to the right of the post content. Don’t worry! You don’t have to learn all that merge tag syntax. When you select a Post Image field from the merge tag drop down, a new drop down will appear with a full list of size and alignment options!
Post Image Merge Tag Options3. Setting the Post Excerpt
Adding a Post Excerpt field to your form will allow the user submitting the form to specify the excerpt content. Like the Post Title and Post Body fields, you will be able to specify the Post Status and Post Author from this field.
4. Setting the Post Category
Adding a Post Category field to your form will allow the user submitting the form to specify which category their post should be filed in. The Post Category field not only allows you to specify which categories should be available in the field, it also provides an option to display the field as one of the following field types: Drop Down, Checkboxes, Radio Buttons, and Multi Select. Selecting “Checkboxes” or “Multi Select” will allow users to select multiple categories to file their post in! This is relatively new functionality available in GF v1.6.3.
Post Category Field SettingsFeel free to add multiple Post Category fields on the same form. Categories from different Post Category fields will be consolidated and applied when the post is created.
5. Setting the Post Tags
Adding a Post Tags field to your form will allow the user submitting the form to specify how their post should be tagged. Tagging is a good way to specify organizable key words and subjects that the post relates to. The Post Tags field provides the option to specify which field type the field should display as. Available field types are: Single Line Text, Drop Down, Multi Select, Checkboxes, and Radio Buttons. If using the “Single Line Text” field type, note that the expected format is a comma-delimited list of tags.
6. Uploading Images to the Post Gallery
Adding a Post Image field to your form will allow the user submitting the form to upload an image to the post gallery. You can include uploaded Post Images in the post content using the “content template” functionality. See the Post Body section above for more details.
The Post Image field also provides options for collecting image meta data. Checking any of the image meta data options will add an additional input to the Post Image field which can be filled in by the submitting user. This data is then stored with the Post Image.
7. Setting the Featured Image
You can specify a particular Post Image field to also be set as the Featured Image (aka Post Thumbnail) of the created post. Just select the “Set as Featured Image” option and Gravity Forms will work it’s magic when the post is created.
Post Image: Setting Featured Image8. Creating Custom Fields
Adding a Post Custom Field will allow the user submitting the form to enter a value which will be stored in a custom field as part of the created post. Custom fields are a simple way to bind related data to a post. Here’s a real example of how the settings might be configured:
Post Custom Field SettingsWith the above configuration in mind, imagine that you’re accepting user-submitted events for a blog about your night life. The data and time of the event will be pretty important. Custom fields to the rescue! With Gravity Forms’ Post Custom Field, you can specify a custom field to which the field value (in this case, the date of the event) should be mapped.
The Post Custom Field can use a variety of different field types including all Standard Field types and most Advanced Field types. This flexible field will allow you to capture a wide range of values include regular text, dates, times, phone numbers, URLs, files and more!
9. Setting the Default Post Status
You can specify the default Post Status from the Post Title, Post Body and Post Excerpt fields. The available options are “Draft”, “Pending Review” or “Published”. A “draft” is a post that is not yet ready to be published. A post which is “Pending Review” is ready to be published pending a review by an administrator. A “published” post is live and viewable by visitors on your website.
Gravity Forms may not support it out of the box, but it’s actually quite easy to set the post status by a user-submitted field value. Here are two handy resources that demonstrate how!
10. Setting the Post Author
Like the Post Status, the default Post Author can be set from the Post Title, Post Body and Post Excerpt fields. You must select a user from the “Default Post Author” drop down; however, if you wish to assign the post author based on the logged in user submitting the form, just check the “User logged in user as author” option. Bare in mind, this option will only work if the user is logged in when submitting the form. Otherwise, the post author will default to the user selected in the drop down.
11. Set the Default Post Format
If you’re running a theme that supports Post Formats or if you’re using implementing them on your own theme, you’ll be happy to hear that Gravity Forms provides support for Post Formats out of the box. The Post Format can be specified on the Post Title and Post Body fields. All standard WordPress Post Formats are supported.
If you’d like some more information on post formats, I’d recommend checking out this walk-through.
Summary
That’s a fairly exhaustive overview of the post creation functionality. As you can see, Gravity Forms post creation functionality is very flexible and super powerful! If you have any questions, please share them with us in the comments.
Hey David! Thanks a lot for the post man, just solved a huge issue for me
My pleasure!
How would I go about displaying the post on another post.
What I am pretty much trying to do is let users create a post on an existing post page. Whichever post page that they created the post from thats where I want the post to show.
It’s almost like looking at a user’s profile. You post the message on the user’s profile, and the message pops up on the same page.
I want to do something similar. I want users to be able to create a post on whatever post page, and then when they create it, that post will now display in the post page that they created their post in. I hope this is somehow making sense. If you know how to do it, it would be awesome.
I’ve been try to use ParentID, and I was able to prepopulate the parentID into their post. So whatever post page they were on, I am able to attach that ID into their post. Now its simply a matter of displaying it. How would I go about doing that?
Very helpful, thanks for taking the time to put this tutorial together, but I wonder if Gravity Forms also allows the upload other types of files, let’s say a zip file. I’m trying to accomplish that and automatically add a download link in the post content area for download. Any experience with that?
Hi Ray, Gravity Forms supports uploading other field types via the “File Upload” field. In your case, since you want this file to be related to the post that is created, you would use the “Custom Field” field under the “Post Fields” section and set the field type of this field to “File Upload”. You can then specify a custom field key in which a URL to the uploaded file would be stored. To display this custom field on the post template, you can provide additional instruction here: http://codex.wordpress.org/Custom_Fields
Brilliant! Thanks very much David!
I just purchased Gravity Forms to use on a user-generated content site I’m developing. So far, I have been enormously frustrated by the lack of (useful and grounded) documentation offered on the GF site. Therefore, I’m really grateful that you put this tutorial together. It demystifies the form to post process at least enough to brush myself off and try again. Of cours, my application varies a fair amount from your example, so I’ll still be scratching my head trying to figure it all out.
Thank you.
Glad to help!
Hi. Thank you for your post.
I run a blog that is growing quickly and i am new to this. every month i send out questions for people to answer and then i post their answers on my blog. but i have to format everyone of them individually and it is becoming too much. I want something where the users can submit their answers. but i want the questions to be displayed in the post in blockquotes and the answer right under them like on here: http://goo.gl/KzcNN to get it to look like that i just put <blockquote> around the questions and then put the answer right under it. could i control the look of the output with any of the plugins you described? or do you know of any that would allow me to do that? thank you for your help.
Hi Marlita, Gravity Forms can handle this. The specific functionality you’re interested in can be accomplished via the Post Content Templates. Hope that helps.
When creating a post from one of these forms, I am able to insert an image of any size I want. However, I can’t figure out how to make that image a link to the original size.
Any ideas? I’m thinking I need to do something akin to:
{Image:5:small:right} .. but have no idea how to get the something in the Template.
Hi Jason, it sounds like you’re already using the Post Content Template feature of the Post Body field. If so, you’re on the right track with your thinking. If you want to display the small image but link to the large image, you should be able to use same field’s merge tag but instead of specifying the size and alignment “filters” you’ll want to add the “url” filter:
<a href='{Image:5:url}' rel="nofollow">{Image:5:small:right}</a>Hi David Smith, nice contribution. i have a very fair question here.following all that we are able to make a content post system, but how to keep a facility of editing the post while still staying at front end? if a post is added by author,subscriber or any profile(admin allow), and then how can that user edit his profile from front end? greatly appreciated.
Hi Frank,
You might try this plugin: http://wordpress.org/extend/plugins/gravity-forms-update-post/
I contacted the author but have not heard back as to whether it is still being actively developed.
You guys ROCK!!!! Thanks for the help.
Hi David, Thanks for the tutorial! I’ve been looking for a solution like this for sometime now. In the demo, I was wondering what you did to generate the link to the post? (Where it says “Your post has been created. View your post here”). Is the link to the post generated in gravity forms? Or is a snippet of code that you placed on the thank-you page. Thanks Again!
Hi Jen, this link is created by using the {post_id} merge tag in the confirmation message like so: http://grab.by/hiMG
Hey David. Thanks so much for this. It was a huge help. I was trying for hours to figure out how to get the image in the post body until I stumbled upon your article here and realized I needed to add the merge tag for the image.
The only thing is that it’s still not working! What happens now is that it creates a simple text post body with no rich formatting and it inserts the image URL without any formatting. This happens no matter what size/orientation I choose in the “select image size” dropdown list.
Any suggestions?
Thanks!
Spoke with Ira via email. She/he was able to resolve this on their own. There was a permissions issue with their uploads folder.
Thank you for that. Very helpful.
Hi, Thank you for this tutorial. I am looking to integrate a front end user generated blog with my buddypress website. I do not wish to approve every post prior to it being published.
Is it possible and easy for the post that the user wrote, to be automatically posted on my website without admin approval?
Yep! All you need to do is set the “Post Status” option to “Published”. This will publish posts generated from the form automatically without requiring any admin approval. More info in this section.
Thank you so much for this tutorial. I’ve been looking for an easy way to have front page user submitted content. This works flawless on my website. One thing that i noticed in your demo that i couldn’t figure out. On your demo after i click submit, i’m sent to a page that read click here to go to your post & has the post link. How can i do this?
Thanks alot
Glad you found the tutorial helpful. To setup your confirmation with a link to the created post, just add the following in your confirmation text wherever you would like the link to appear:
View your post here!Here is what the confirmation looks like on the demo form: http://grab.by/koxY
hey David, I wonder how to map “Advanced Form Fields” e.g “name”, “List”, etc to custom fields. Obviously these gravity form fields are not supported by WordPress standard field, but I am desperately want them on my post. Please help,
thank you
List field is available as a field type for Custom Fields: http://grab.by/kvco
I’m actually surprised the Name field isn’t available for Custom Fields, but here is a simple work around.
1 – Add a “Custom Field” field to your form and set it to the “Hidden” field type. 2 – Add a “Name” field to your form. 3 – Paste this snippet into your theme’s functions.php file: http://snippi.com/s/o0jipcx There are some instructions inline to get this configured for your own form.
Does someone know a way to show to the user (and if possible send a notification) with the link of the resulting post?
Thanks
Hi Bruno, this comment has a quick breakdown on how to do this.
I posted this query on the WP forums with no love. I am using Gravity forms to post data for the purpose of ride sharing to the beach. I have a category post field set up for the select options of ‘give a ride’ and ‘get a ride’. I want to (if possible)combine the data from this select menu to display beside the post title info. which displays on the recent post info in the right column. I assume this can be done with some PHP manipulation, but not exactly sure how.
any ideas? Let me know if I need to explain more…
You might consider using the Post Title Content Template. You can find that in your Post Title field settings: http://grab.by/niVS
Great! Exactly what I was looking for, thanks David!
Hi David,
God bless you man.
And thank you!
Hello. This is useful article for someone like me who is considering purchasing Gravity Forms. However, before I go ahead with it, I’m curious to know whether it can do what I need it to do for a user generated photo sharing website.
1) Is it possible to batch upload more than one image to create a WP gallery within the post? 2) If so, is it possible to automatically set, say… the first image in the upload as the featured image for the post?
Hi Rick, Gravity Forms has a “Post Image” field. You can add multiple Post Image fields to allow the user to upload multiple images to the post gallery. Additionally, there is a setting on the Post Image field that allows you to indicate that it should be the featured image for the created post.