Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aimahdi/00a0c1dbca9e4ca6fdd514c0c8e03fc6 to your computer and use it in GitHub Desktop.
Save aimahdi/00a0c1dbca9e4ca6fdd514c0c8e03fc6 to your computer and use it in GitHub Desktop.
add_filter('fluentform/rendering_field_data_custom_html', function ($data, $form)
{
if($form->id != 50) { //change the form id with your own form id
return $data;
}
global $post;
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); // Get the thumbnail ID
if ( $thumbnail_id ) {
$image_url = wp_get_attachment_image_url( $thumbnail_id, 'full' ); // Get the image URL
$data['settings']['html_codes'] = '<img src="' . esc_url( $image_url ) . '" width=300, height=300 alt="" />'; // Display the image
}
// Do your stuffs here
return $data;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment