Skip to content

Commit 95344df

Browse files
author
dariospace
authored
Create gppa-acf-date-formatter.php
added snippet
1 parent 84326a0 commit 95344df

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Populate Anything // Convert ACF Date Into Gravity Forms Date
4+
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
5+
*
6+
* Plugin Name: GPPA ACF Relationships
7+
* Plugin URI: http:///gravitywiz.com.com/documentation/gravity-forms-populate-anything/
8+
* Description: This snippet will format the value from a ACF Date field that is retrieved from the database and convert it into a Gravity Forms format Date field.
9+
* Author: Gravity Wiz
10+
* Version: 0.1
11+
* Author URI: http://gravitywiz.com
12+
*
13+
* Add "gppa-format-acf-date" to the "Custom CSS Class" setting (on the Appearance tab).
14+
*/
15+
// Update "123" to your form ID.
16+
add_filter( 'gppa_process_template_value_123', function( $template_value, $field, $template_name, $populate, $object, $object_type, $objects ) {
17+
18+
if ( strpos( $field->cssClass, 'gppa-format-acf-date' ) === false ) {
19+
return $template_value;
20+
}
21+
return date( 'd/m/Y', strtotime( $template_value ) );
22+
}, 10, 7 );

0 commit comments

Comments
 (0)