image_align_input_fields

The timeline below displays how wordpress function image_align_input_fields has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Retrieves HTML for the image alignment radio buttons with the specified one checked.
 *
 * @since 2.7.0
 *
 * @param WP_Post $post
 * @param string  $checked
 * @return string
 */
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';
    }
    $output = array();
    foreach ($alignments as $name => $label) {
        $name = esc_attr($name);
        $output[] = "<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 implode("\n", $output);
}

WordPress Version: 5.6

/**
 * Retrieve HTML for the image alignment radio buttons with the specified one checked.
 *
 * @since 2.7.0
 *
 * @param WP_Post $post
 * @param string  $checked
 * @return string
 */
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 implode("\n", $out);
}

WordPress Version: 5.5

/**
 * Retrieve HTML for the image alignment radio buttons with the specified one checked.
 *
 * @since 2.7.0
 *
 * @param WP_Post $post
 * @param string  $checked
 * @return string
 */
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);
}

WordPress Version: 5.1

/**
 * Retrieve HTML for the image alignment radio buttons with the specified one checked.
 *
 * @since 2.7.0
 *
 * @param WP_Post $post
 * @param string $checked
 * @return string
 */
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);
}

WordPress Version: 4.1

/**
 * Retrieve HTML for the image alignment radio buttons with the specified one checked.
 *
 * @since 2.7.0
 *
 * @param WP_Post $post
 * @param string $checked
 * @return string
 */
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);
}

WordPress Version: 3.7

/**
 * Retrieve HTML for the image alignment radio buttons with the specified one checked.
 *
 * @since 2.7.0
 *
 * @param object $post
 * @param string $checked
 * @return string
 */
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);
}