public function timetodate($timestamp, $format = null) { require_once WPTOOLSET_FORMS_ABSPATH . '/classes/class.date.php'; return WPToolset_Field_Date::timetodate($timestamp, $format); }
/** * Show value of custom field. * * Show value of custom field. * * @since 1.6.6 * * @param string $column Column name, * @param int $var Current post ID. */ public function manage_custom_columns($column, $post_id) { $value = get_post_meta($post_id, $column, true); if (empty($value)) { return; } $field = wpcf_admin_fields_get_field_by_meta_key($column); if (isset($field['type'])) { switch ($field['type']) { case 'image': $default_width = '100px'; /** * Width of image. * * Filter allow to change default image size displayed on * admin etry list for custom field type image. Default is * 100px - you can change it to any proper CSS width * definition. * * @since 1.7 * * @param string $var Default width "100px". */ $width = apply_filters('wpcf_field_image_max_width', $default_width); if (empty($width)) { $width = $default_width; } $value = sprintf('<img src="%s" style="max-width:%s" alt="" />', esc_attr($value), esc_attr($width)); break; case 'skype': $value = isset($value['skypename']) ? $value['skypename'] : ''; break; case 'date': require_once WPTOOLSET_FORMS_ABSPATH . '/classes/class.date.php'; $value = WPToolset_Field_Date::timetodate($value); break; } } if (is_string($value)) { echo $value; } }
/** * Show value of custom field. * * Show value of custom field. * * @since 1.6.6 * * @param string $column Column name, * @param int $var Current post ID. */ public function manage_custom_columns($column, $post_id) { $value = get_post_meta($post_id, $column, true); if (empty($value)) { return; } $field = wpcf_admin_fields_get_field_by_meta_key($column); if (isset($field['type'])) { switch ($field['type']) { case 'image': $value = sprintf('<img src="%s" width="120" />', $value); break; case 'skype': $value = isset($value['skypename']) ? $value['skypename'] : ''; break; case 'date': require_once WPTOOLSET_FORMS_ABSPATH . '/classes/class.date.php'; $value = WPToolset_Field_Date::timetodate($value); break; } } if (is_string($value)) { echo $value; } }