How to get post id of first child of the same post type?
Instead of: $args = array( ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order’, ‘post_type’ => ‘attachment’, ‘post_parent’ => $post->ID, ‘post_mime_type’ => ‘image’, ‘numberposts’ => 1, ); Use: $args = array( ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order’, ‘post_type’ => get_post_type($post), ‘post_parent’ => $post->ID, ‘numberposts’ => 1, ); You could also use post/page/etc or ‘any’