Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time to datepicker field #59

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified css/custom-metadata-manager.css
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions custom_metadata.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,17 @@ function init_columns() {

// Hook into Column Content. Users get filtered, others get actioned.
if ( ! in_array( $object_type, $this->_column_filter_object_types ) )
add_action( "manage_{$column_content_name}_custom_column", $custom_column_content_function, 10, 3 );
add_action( "manage_{$column_header_name}_custom_column", $custom_column_content_function, 10, 3 );
else
add_filter( "manage_{$column_content_name}_custom_column", $custom_column_content_function, 10, 3 );
add_filter( "manage_{$column_header_name}_custom_column", $custom_column_content_function, 10, 3 );

}

function enqueue_scripts() {
wp_enqueue_media();
wp_enqueue_script( 'select2', apply_filters( 'custom_metadata_manager_select2_js', CUSTOM_METADATA_MANAGER_URL .'js/select2.min.js' ), array( 'jquery' ), CUSTOM_METADATA_MANAGER_SELECT2_VERSION, true );
wp_enqueue_script( 'custom-metadata-manager-js', apply_filters( 'custom_metadata_manager_default_js', CUSTOM_METADATA_MANAGER_URL .'js/custom-metadata-manager.js' ), array( 'jquery', 'jquery-ui-datepicker', 'select2' ), CUSTOM_METADATA_MANAGER_VERSION, true );
wp_enqueue_script( 'custom-metadata-manager-datetimepicker', apply_filters( 'custom_metadata_manager_default_js', CUSTOM_METADATA_MANAGER_URL .'js/jquery-ui-timepicker-addon.js' ), array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-slider' ), CUSTOM_METADATA_MANAGER_VERSION, true );
}

function enqueue_styles() {
Expand Down Expand Up @@ -1009,7 +1010,7 @@ function _display_metadata_field( $field_slug, $field, $object_type, $object_id
echo '</select>';
break;
case 'datepicker' :
$datepicker_value = ! empty( $v ) ? esc_attr( date( 'm/d/Y', $v ) ) : '';
$datepicker_value = ! empty( $v ) ? esc_attr( date( 'm/d/Y G:i', $v ) ) : '';
printf( '<input type="text" name="%s" value="%s"%s%s/>', esc_attr( $field_id ), $datepicker_value, $readonly_str, $placeholder_str );
break;
case 'wysiwyg' :
Expand Down
Loading