attachment_id3_data_meta_box

函数
attachment_id3_data_meta_box ( $post )
参数
  • (WP_Post) $post Current post object.
    Required:
定义位置
相关方法
attachment_submit_meta_boxpost_comment_status_meta_boxattachment_submitbox_metadataget_hidden_meta_boxespost_comment_meta_box
引入
3.9.0
弃用
-

attachment_id3_data_meta_box: 这个函数用来显示媒体库中的音频文件的ID3元数据: 当媒体库被显示时,它会被调用。

显示ID3数据的字段。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function attachment_id3_data_meta_box( $post ) {
$meta = array();
if ( ! empty( $post->ID ) ) {
$meta = wp_get_attachment_metadata( $post->ID );
}
foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) :
$value = '';
if ( ! empty( $meta[ $key ] ) ) {
$value = $meta[ $key ];
}
?>
<p>
<label for="title"><?php echo $label; ?></label><br />
<input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="<?php echo esc_attr( $value ); ?>" />
</p>
<?php
endforeach;
}
function attachment_id3_data_meta_box( $post ) { $meta = array(); if ( ! empty( $post->ID ) ) { $meta = wp_get_attachment_metadata( $post->ID ); } foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : $value = ''; if ( ! empty( $meta[ $key ] ) ) { $value = $meta[ $key ]; } ?> <p> <label for="title"><?php echo $label; ?></label><br /> <input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="<?php echo esc_attr( $value ); ?>" /> </p> <?php endforeach; }
function attachment_id3_data_meta_box( $post ) {
	$meta = array();
	if ( ! empty( $post->ID ) ) {
		$meta = wp_get_attachment_metadata( $post->ID );
	}

	foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) :
		$value = '';
		if ( ! empty( $meta[ $key ] ) ) {
			$value = $meta[ $key ];
		}
		?>
	<p>
		<label for="title"><?php echo $label; ?></label><br />
		<input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="<?php echo esc_attr( $value ); ?>" />
	</p>
		<?php
	endforeach;
}

常见问题

FAQs
查看更多 >