Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gravity Perks // Nested Forms // Preview Files Uploaded With GP Media Library
<?php
/**
* Gravity Perks // Nested Forms // Preview Files Uploaded With GP Media Library
*
* @version 1.0
* @author Scott Buchmann <scott@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
* @copyright 2020 Gravity Wiz
*/
// Update "123" with your form ID.
add_action( 'gpnf_fileupload_display_value_123', function ( $value ) {
$url = attachment_url_to_postid( $value['value'] );
$thumb = wp_get_attachment_image_src( $url );
$value['label'] = '<img src="' . $thumb[0] . '" >';
return $value;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment