这项工作:
$images = get_children( array(
\'post_parent\' => $post->ID,
\'post_type\' => \'attachment\',
\'post_mime_type\' => \'image\',
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
\'numberposts\' => 999
));
if ( $images ) {
$total_images = count( $images );
}
变量$total\\u images将保存库中的图像数。