touch_time
函数
touch_time ( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 )
- 参数
-
-
(int|bool)
$edit
Accepts 1|true for editing the date, 0|false for adding the date.- Required: 否
- Default: 1
-
(int|bool)
$for_post
Accepts 1|true for applying the date to a post, 0|false for a comment.- Required: 否
- Default: 1
-
(int)
$tab_index
The tabindex attribute to add. Default 0.- Required: 否
-
(int|bool)
$multi
Optional. Whether the additional fields and buttons should be added. Default 0|false.- Required: 否
-
(int|bool)
- 定义位置
-
-
wp-admin/includes/template.php
, line 792
-
wp-admin/includes/template.php
- 引入
- 0.71
- 弃用
- –
打印出HTML表格的日期元素,用于编辑文章或评论的发布日期。
function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
global $wp_locale;
$post = get_post();
if ( $for_post ) {
$edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ), true ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' === $post->post_date_gmt ) );
}
$tab_index_attribute = '';
if ( (int) $tab_index > 0 ) {
$tab_index_attribute = " tabindex="$tab_index"";
}
// @todo Remove this?
// echo '
';
$post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date;
$jj = ( $edit ) ? mysql2date( 'd', $post_date, false ) : current_time( 'd' );
$mm = ( $edit ) ? mysql2date( 'm', $post_date, false ) : current_time( 'm' );
$aa = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : current_time( 'Y' );
$hh = ( $edit ) ? mysql2date( 'H', $post_date, false ) : current_time( 'H' );
$mn = ( $edit ) ? mysql2date( 'i', $post_date, false ) : current_time( 'i' );
$ss = ( $edit ) ? mysql2date( 's', $post_date, false ) : current_time( 's' );
$cur_jj = current_time( 'd' );
$cur_mm = current_time( 'm' );
$cur_aa = current_time( 'Y' );
$cur_hh = current_time( 'H' );
$cur_mn = current_time( 'i' );
$month = '';
$day = '';
$year = '';
$hour = '';
$minute = '';
echo '';
if ( $multi ) {
return;
}
echo "nn";
$map = array(
'mm' => array( $mm, $cur_mm ),
'jj' => array( $jj, $cur_jj ),
'aa' => array( $aa, $cur_aa ),
'hh' => array( $hh, $cur_hh ),
'mn' => array( $mn, $cur_mn ),
);
foreach ( $map as $timeunit => $value ) {
list( $unit, $curr ) = $value;
echo '' . "n";
$cur_timeunit = 'cur_' . $timeunit;
echo '' . "n";
}
?>
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


