gelöst
Hallo,
ich habe mein Problem gelöst. Für alle die ähnliches vorhaben hier meine Lösung:
PHP
# Displays post image attachment (sizes: thumbnail, medium, full)
function dp_attachment_image($postid=0, $size='thumbnail', $attributes='') {
if ($postid<=1) $postid = get_the_ID();
if ($images = get_children(array(
'post_parent' => $postid,
'post_type' => 'attachment',
'numberposts' => 1,
'post_mime_type' => 'image',
'orderby' => 'menu_order',)))
foreach($images as $image) {
$attachment=wp_get_attachment_image_src($image->ID, $size);
?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php
}
}
Alles anzeigen
Ich habe die Funktion um [COLOR=#ff0000]'orderby' => 'menu_order', [COLOR=black]erweitert, somit wird immer das Bild mit der höchsten Reihenfolgenzahl angezeigt.[/COLOR][/COLOR]
Gruß
Martin