我不知道 menu_order 有什么问题,但帖子没有按我的意愿显示。这就是我的意思
我的博客中有 3 篇文章。这是 db 的样子
id ..... menu_order
56 ..... 2
59 ..... 5
65 ..... 3
index.php(我的自定义主题)
我只想显示图像所以这是我使用的代码
<?php while ( have_posts() ) : the_post();
$images = get_children(
array( 'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'DESC',
'numberposts' => 999 )
);
if( $images )
{
$total_images = count( $images );
$image = array_shift( $images );
echo wp_get_attachment_image($image->ID, 'full', 0, array('id' => 'photo'));
}
endwhile; // end of the loop.
?>
问题是帖子按 id 65,59,56 的顺序显示,而不是我预期的 59,65,56
这有什么问题?