Last active
January 12, 2022 19:01
-
-
Save scyt/45187170122d4c39875c12e304361fe4 to your computer and use it in GitHub Desktop.
Gravity Perks // Nested Forms // Preview Files Uploaded With GP Media Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WARNING! THIS SNIPPET MAY BE OUTDATED. | |
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library: | |
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-current-time-merge-tags.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
👉 This Gist has been migrated to the Gravity Wiz Snippet Library:
https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-current-time-merge-tags.php