所以我需要传递多个值,但我不知道怎么做? 有什么建议吗?
$myarray = array('144', '246');
$images = get_children(array(
'title_li' => '',
'post_parent' => $myarray,
'sort_order' => 'DESC',
'sort_column' => 'menu_order'
)
);
答案 0 :(得分:2)
您可以使用WP_Query对象执行此操作:
$children_query = new WP_Query(array(
'post_type' => 'attachment',
'orderby' => 'menu_order',
'order' => 'DESC',
'post_parent__in' => array('144', '246')
));
if($children_query->have_posts()){
while($children_query->have_posts()){
$children_query->the_post();
// your display
}
wp_reset_postdata();
}
这将查找附加到array