你好,我一直在努力寻找解决方案。基本上,我只想从帖子中检索所有图像,并在下面显示标题。下面是我使用的代码:
<?php
$argsThumb = array(
\'order\' => \'DESC\',
\'post_type\' => \'attachment\',
\'post_parent\' => $post->ID,
\'post_mime_type\' => \'image\',
\'post_status\' => null
);
$attachments = get_posts($argsThumb);
if ($attachments) {
foreach ($attachments as $attachment) {
echo \'<div class="slideshow-content"><img src="\'.wp_get_attachment_url($attachment->ID, \'thumbnail\', false, false).\'" /><div class="captions"><p>\'.apply_filters(\'the_title\', $attachment->post_title).\'</p></div></div>\';
}
}
?>
正如您所看到的,它当前显示的是标题,而不是标题。我尝试过使用:$标题=$附件->post\\u摘录;-但不确定在何处实施,我所做的尝试也不起作用。任何帮助都将不胜感激!