基本的に私は親ページのギャラリーを取得しようとしています、そしてそれを行うためにquery_postsで遊んでいます、次のコードは私が必要なものに近づいているようですが、実際には他の場所からだけでなく添付ファイルを取得しています現在のページの親ページ、誰か?:
<?php
$args = array('post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => 0,
'order_by' => 'menu_order',
'order' => 'ASC');
$attachments = get_posts($args);
if($attachments)
{
echo '<ul class="imagelist">';
foreach($attachments as $attachment)
{
echo '<li>';
$large = wp_get_attachment_image_src($attachment->ID, 'large');
$thumb = wp_get_attachment_image($attachment->ID, 'thumbnail');
echo '<a href="'. $large[0] .'">' . $thumb . '</a>';
echo '</li>';
}
echo '</ul>';
}
?>