Open rgbashok opened 2 years ago
this code should activate the missing options tell me if you managed to make your idea work and if possible explain why
add_filter( 'jet-engine/listings/macros-list', 'register_format_date_macro' );
function register_format_date_macro( $macros_list ) {
$macros_list['format_date'] = array(
'label' => 'Format date',
'cb' => '_get_formatted_date',
'args' => array( 'format' => array(
'label' => 'Format',
'type' => 'text',
),),
);
return $macros_list;
}
function _get_formatted_date( $field_value = null, $format = 'd.m.Y' ) {
$result = date_i18n( $format );
return $result;
}
then %format_date|n% - will display the month %format_date|Y% - will display the year (4 numbers)
@nreljed, My intent is different, I have a datetime(Local) custom meta, I am building an query in Jet engine to filter the post based on the current time.
i.e. let say if the time I have mentioned in the custom meta is past current time then the post should not show on the query result.
In the Jetengine query builder, meta query can be created based on today date, but it would be good to create it based on current time.
This will be useful for the timer based posts.