get_children()并设置alt图像=滑块

How can I get images to have the alt set to "slider"?

This is my code:

$args = array(
    'post_parent' => $post->ID,
    'post_type' => 'attachment',
    'orderby' => 'menu_order',  
    'order' => 'ASC',
    'numberposts' => 5, 
    'post_mime_type' => 'image'
);
if ( $images = get_children( $args ) ) {

echo '<div id="sliderbody" style="width:640px; height:480px;"><div id="slider">';

        foreach( $images as $image ) {
            echo wp_get_attachment_image( $image->ID, 'trueslider' );
        }
echo '</div></div>'; 
}

I guess you're trying to set the alt attribute to always be "slider" so try this

$args = array(
    'post_parent' => $post->ID,
    'post_type' => 'attachment',
    'orderby' => 'menu_order',  
    'order' => 'ASC',
    'numberposts' => 5, 
    'post_mime_type' => 'image'
);
if ( $images = get_children( $args ) ) {

echo '<div id="sliderbody" style="width:640px; height:480px;"><div id="slider">';

        foreach( $images as $image ) {
            echo wp_get_attachment_image( $image->ID, 'trueslider', false, array('alt' => 'slider') );
        }
echo '</div></div>'; 
}