Hi @mshaidulatov,
EM user here too. Let me see if I understand you correctly…
You’ve created custom fields using ACF and want to use them in the front-end with Em’s #_ATT{}. Right?
without interrupting core code of EM
You are only touching the core code if you edit a core php file. ??
All date fields are always saved to the database in the international technical notation: Y-m-d.
Calling a post meta value with #_ATT{field_name} (in EM) is exactly the same as using {cf:field_name} (in ACF). They both fetch the static value of the post meta key. So if it’s saved as Y-d-m, it will be outputted as Y-m-d.
Events Manager is extremely flexible and allows to manipulate just about every output. The pure magic of: Custom Placeholders. ??
https://wp-events-plugin.com/tutorials/create-a-custom-placeholder-for-event-formatting/
You will need to create a new placeholder for each your custom fields you wish to manipulate/change.
For example, the ACF date field saved “date of birth” as field name “date_of_birth” in the default Y-m-d format. Then this would be your custom placeholder code:
function em_change_acf_date_format($replacement, $EM_Event, $result) {
global $EM_Event;
if( $result === "#_DATEOFBIRTH" ) {
// Fetch the original field value from the database.
$original = $EM_Event->output("#_ATT{date_of_birth}");
// Convert the date to the saved date format in your EM Settings.
$replacement = date_i18n( get_option('dbem_date_format'), strtotime( $original ) );
}
return $replacement;
}
add_filter('em_event_output_placeholder', 'em_change_acf_date_format', 10, 3);
Then within EM you can simply call #_DATEOFBIRTH instead of #_ATT{date_of_birth} to echo the altered output.