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資料的欄位。

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
檢視更多 >