how automatically show the image title before the image caption/description in a wordpress gallery?

I am using a simple Wp 5.x gallery like this [gallery size=full columns=1 ids=6304,6305,6306,6307,6308,6309]

The gallery shows me the images and the captions/description after the image. How can I automatically insert/inject the gallery image title BEFORE this image captions/description?

See image expample attached

Thanks in advance

Topic title captions gallery images Wordpress

Category Web


use this code in single.php

  $post->ID,
        'post_type' => 'attachment',
        'numberposts' => -1,
        'orderby'        => 'title',
        'order'           => 'ASC',
        'post_mime_type' => 'image',
    )))
    {
        foreach( $images as $image ) {
            $attachmenturl = wp_get_attachment_url($image->ID);
            $attachmentimage = wp_get_attachment_image_src( $image->ID, full );
            $imageDescription = apply_filters( 'the_description' , $image->post_content );
            $imageTitle = apply_filters( 'the_title' , $image->post_title );
            $i++;
            if (!empty($imageTitle)) {
                echo ' » '.$imageDescription.'';
} else { echo '' ; }
        }
    } else {
        echo 'No Image Found';
    }?>

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.