Advertisement
chrishajer

Set post thumbnail to a radio button value

Mar 6th, 2013
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/display-featured-image-selection-based-on-conditional-logic#post-161066
  3. // change the 98 here to your form ID
  4. add_action('gform_after_submission_98', 'set_featured_image', 10, 2);
  5. function set_featured_image($entry, $form){
  6.     // change $entry['2'] to the field where the radio button
  7.     // image was selected mine was field 2.  The value of that
  8.     // radio button should be the attachment ID
  9.     set_post_thumbnail($entry['post_id'], $entry['2'];);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement