Last active
June 7, 2019 10:08
-
-
Save MjHead/817004cab81e712c59056cd21e34c49c 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-posts/section_posts_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-blog-smart-listing/section_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_number_format' => 'jet_custom_number_format', | |
'jet_custom_trim_chars' => 'jet_custom_trim_chars', | |
) | |
); | |
$controls_stack->update_control( $control_id, array( 'fields' => $fields ) ); | |
} | |
} | |
function jet_custom_number_format( $number ) { | |
return number_format( $number, 0, '.', ' ' ); | |
} | |
function jet_custom_trim_chars( $desc ) { | |
return mb_strimwidth( $desc, 0, 20, '...' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment