Я пытаюсь получить все вложения с текущей страницы WordPress. Но мой код показывает только первый результат. В чем проблема?
Мой код
<?php
$attachments = get_children(array(
'post_parent' => $post->ID,
'post_status' => 'any',
'post_type' => 'attachment',
'post_mime_type' => 'image'
)
);
foreach($attachments as $att_id => $attachment) {
if (get_post_meta( $attachment->ID, '_bildnachweis', true )) {
$full_img_caption = get_post_meta( $attachment->ID, '_bildnachweis', true );
echo $full_img_caption; // Here I need more results, but the browser shows me only one.
}
}
?>
echo $full_img_caption;
показывает мне только один результат вместо трех существующих изображений для страницы. Есть проблема с моим foreach
l oop?