'ASC', 'orderby' => 'menu_order', 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1 ); $attachments = get_posts($args); $attachments_num = count($attachments); if ($attachments_num == 0) { if ( has_post_thumbnail( $post->ID ) ) { $featured_image_id = get_post_thumbnail_id($post->ID); unset($attachments,$attachments_num); $args = array( 'p' => $featured_image_id, 'post_type' => 'attachment', 'post_mime_type' => 'image' ); $attachments = get_posts($args); $attachments_num = count($attachments); } } } $i = 0; if ( $attachments_num > 1 ) { ?>