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.

Set As Post's Featured Image

  1. Mochajen
    Member

    According to your documentation (http://www.gravityhelp.com/documentation/page/Post_Image ), when building a post form I only need to click the Set As Featured Image box - yet that option doesn't seem to exist on my version. Please advise me how I can connect the submitted image to the submitted post (no coding I hope).

    As soon as I get this figured I'll be upgrading to a Developer license.
    Thanks,
    Jen

    Posted 13 years ago on Friday September 2, 2011 | Permalink
  2. The 'set as featured image' functionality was added to the 1.6 version which is in beta now. You can try the beta version now if you like, or I can point you to a solution using functions.php to work with your current version (1.5.2.8 is the latest production release.)

    Posted 13 years ago on Friday September 2, 2011 | Permalink
  3. You can add this code (make modifications where noted) to your theme's functions.php to set the featured image in versions prior to 1.6.

    http://pastie.org/2270372

    Posted 13 years ago on Friday September 2, 2011 | Permalink
  4. Mochajen
    Member

    I have added your code to the theme's functions.php file (ensuring to replace the 4 with the actual form ID) and replaced the old file with the new one. However, I see nothing different. There are no new settings added to the form's setup screen, and the image is uploaded to the media library but is not tied to the post in any way.

    Is there another step I'm skipping?

    Posted 13 years ago on Saturday September 3, 2011 | Permalink
  5. You will not see anything on the form builder screen. What the code is supposed to do is after the post is created, get the last attachment to the post, and set it as the post thumbnail (featured image.)

    Is that not happening?

    What old file did you replace with a new one? Old functions.php with the new edited one?

    So, the post is created, and the image is being uploaded, but the image is not associated with the post? Are you using a "Post Field > Image", or an "Advanced Field > File Upload" field? Also, is your theme set up to use the featured image and that's working for other posts where you've set the featured image manually?

    Posted 13 years ago on Saturday September 3, 2011 | Permalink
  6. Mochajen
    Member

    The problem was that theme didn't support Featured Image. I've since tried it on another theme (bought the developer license first), used your code above and it seems to be working. I'm excited for the 1.6 full release. Thanks for your great support.

    Posted 13 years ago on Wednesday September 7, 2011 | Permalink
  7. Thank you for the update.

    Posted 13 years ago on Thursday September 8, 2011 | Permalink

This topic has been resolved and has been closed to new replies.