PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Simple Post Thumbnails + Gravity Form

  1. leprakhauns

    Is there an easy way to have it upload an image and post content and that image be its post thumbnail automatically?

    Posted 13 years ago on Thursday January 27, 2011 | Permalink
  2. Wondering the same thing ... anybody?

    Posted 13 years ago on Tuesday February 8, 2011 | Permalink
  3. This isn't currently a native feature. It is something we plan on adding in a future release. It is possible to do now but requires custom code and the use of available API hooks.

    Here is an example:

    Posted 13 years ago on Tuesday February 8, 2011 | Permalink
  4. Hello

    Here is a simple code that makes a post thumbnail (featured image in Wordpress 3.2) from first photo attached to the post.

    add_action("gform_post_submission", "my_post_submission", 10, 2);
    function my_post_submission($entry, $form){
      # Here you should check if $form is the right form, otherwise it will work for all forms.
      $post = get_post($entry["post_id"]);
      $arrImages =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . $entry["post_id"] );
      if(is_array($arrImages)) {
        foreach ($arrImages as $attachment_id => $Image) {
          set_post_thumbnail( $post, $attachment_id );
    Posted 12 years ago on Saturday July 30, 2011 | Permalink