Skip to content

Instantly share code, notes, and snippets.

@kaskad88
Last active January 18, 2023 07:08
Show Gist options
  • Save kaskad88/eb35ae49f312d95746b13d3fde25d0f1 to your computer and use it in GitHub Desktop.
Save kaskad88/eb35ae49f312d95746b13d3fde25d0f1 to your computer and use it in GitHub Desktop.
add_filter( 'do_shortcode_tag', function ( $output, $tag, $attr ) {
if ( 'jet_engine' !== $tag ) {
return $output;
}
if ( empty( $attr['component'] ) || 'meta_field' !== $attr['component'] ) {
return $output;
}
$date_keys = array( 'feastday', 'date_field_1', 'date_field_2' ); // date fields list
if ( empty( $attr['field'] ) || ! in_array( $attr['field'], $date_keys ) ) {
return $output;
}
if ( empty( $output ) ) {
return $output;
}
$format = get_option( 'date_format' ); // or set custom date format. Ex.: $format = 'F j, Y';
$output = date_i18n( $format, $output );
return $output;
}, 10, 3 );
@codeintopixel
Copy link

@kaskad88 Currently "Save as timestamp" option is ON for both fields, earlier when option was OFF it was showing correctly in mails.
I have tried and tested after adding this code, still showing in same format. This form is created using JetFormBuilder.

image

@kaskad88
Copy link
Author

@codeintopixel Could you please attach a screen with your email template in JetFormBuilder https://tppr.me/4eT8f

@codeintopixel
Copy link

image

Here you go @kaskad88

@kaskad88
Copy link
Author

@codeintopixel for your case the code is above not needed.

Replace the string %customer-due-date% on %customer-due-date|format_date% in the content field.

@codeintopixel
Copy link

This worked, one typo here though instead of hypen(-) we have to use underscore(_). As this is what macros accepting in form builder. Thank you for your quick responses. 👯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment