Wordpress
Codeschnipsel
Bilder zu einem Artikel anzeigen
<?php $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent='.$post->ID); if ( empty($images) ) { // No images found } else { foreach ( $images as $attachment_id => $attachment ) { $image = wp_get_attachment_image_src( $attachment_id, 'full' ); echo '<img src="'.$image[0].'" alt="">'; } } ?>
Hinweis: Es erlaubt nur Zugriff auf Breite, Höhe und SRC des Bildes, nicht auf Alternativtexte (Die hat es aber im konkreten Anwendungsfall nicht gebraucht).
