检查指定的一个图像对齐单选按钮的HTML。

原型

image_align_input_fields( WP_Post $post, string $checked = '' )

参数

$post (WP_Post) (Required)

$checked (string) (Optional)

返回值

(string)  

源文件

路径:wp-admin/includes/media.php

<?php
...
function image_align_input_fields( $post, $checked = '' ) {
	if ( empty($checked) )
		$checked = get_user_setting('align', 'none');
	$alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right'));
	if ( !array_key_exists( (string) $checked, $alignments ) )
		$checked = 'none';
	$out = array();
	foreach ( $alignments as $name => $label ) {
		$name = esc_attr($name);
		$out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".
			( $checked == $name ? " checked='checked'" : "" ) .
			" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";
	}
	return join("n", $out);
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/image_align_input_fields/