Last active
December 30, 2023 21:43
-
-
Save MjHead/3df09abf2b1cfe74eb69d2649462d71b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
add_action( | |
'elementor/element/jet-blog-smart-listing/section_custom_fields/before_section_end', | |
'jet_custom_meta_callbacks' | |
); | |
add_action( | |
'elementor/element/jet-blog-smart-tiles/section_custom_fields/before_section_end', | |
'jet_custom_meta_callbacks' | |
); | |
add_action( | |
'elementor/element/jet-posts/section_posts_custom_fields/before_section_end', | |
'jet_custom_meta_callbacks' | |
); | |
function jet_custom_meta_callbacks( $controls_stack ) { | |
foreach ( array( 'content_related_meta', 'title_related_meta' ) as $control_id ) { | |
$control = $controls_stack->get_controls( $control_id ); | |
$fields = $control['fields']; | |
$fields[3]['options'] = array_merge( | |
$fields[3]['options'], | |
array( | |
'jet_custom_date' => 'jet_custom_date', | |
) | |
); | |
$controls_stack->update_control( $control_id, array( 'fields' => $fields ) ); | |
} | |
} | |
function jet_custom_date( $value ) { | |
return date( get_option( 'date_format' ), $value ); | |
} | |
add_filter( 'jet-engine/listings/allowed-callbacks', 'jet_add_date_to_dynamic_fields_filters' ); | |
/** | |
* Add jet_custom_date callback to JetEngine Dynamic Field filters | |
*/ | |
function jet_add_date_to_dynamic_fields_filters( $callbacks ) { | |
$callbacks['jet_custom_date'] = 'Custom Date Format'; | |
return $callbacks; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment