You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Love your plugin.
Just wish i could have more power with the post images. Gravity forms doesnt let you save a post image to a custom field. So made my own way here:
I use pods to make custom fields of type image. The value msut be a media ID.
When i add post image fields in gravity forms I can make them save to the post by grabbing the media_id which is put at the end of the entry value string for post images. Like this:
add_action( 'gform_after_submission', 'add_post_image', 10, 2 );
function add_pot_image( $entry, $form ) {
//it is being saved to a post
if(isset($entry['post_id']) ){
$post_id = $entry['post_id'];
foreach($form['fields'] as $field){
//if its a post image type and is not being saved as featured and the class starts with field_
if($field['type'] == 'post_image' && $field['postFeaturedImage'] == '' && strpos($field['cssClass'], 'field_') !== false){
$entry_id = $field['id'];
//getting the last digits which are the media_id from entry value
preg_match('/[0-9]*$/', $entry[$entry_id], $value);
//css class must start with field_ this way you can still have other css classes
preg_match('/field_(\w*)/', $field['cssClass'], $custom_field);
update_post_meta($post_id, $custom_field[1], $value[0]);
}
}
}
}
Here if a field has a css class of field_something it will find post meta with key 'something' and add the image.
Now how the heck can I prepopulate this and have it save!! Post images doesnt even let you pre poulate! ugh...
The text was updated successfully, but these errors were encountered:
Love your plugin.
Just wish i could have more power with the post images. Gravity forms doesnt let you save a post image to a custom field. So made my own way here:
I use pods to make custom fields of type image. The value msut be a media ID.
When i add post image fields in gravity forms I can make them save to the post by grabbing the media_id which is put at the end of the entry value string for post images. Like this:
Here if a field has a css class of field_something it will find post meta with key 'something' and add the image.
Now how the heck can I prepopulate this and have it save!! Post images doesnt even let you pre poulate! ugh...
The text was updated successfully, but these errors were encountered: