Thanks for your question and for including the HTML markup you are seeing as well as the screen shot; very helpful. Thanks, @ljosh, for your suggestion.
There is often confusion about the definition and use of Title, ALT Text and Caption in WordPress applications. This is also complicated by the different image insertion features in the “Classic” editor and the new Gutenberg block-oriented editor.
First, let me make sure I understand the original question. You wrote “As you can see in the code, there is the “alt text” but not the “title text” (from media libary)“. Do you mean that the < IMG >
tag does not include a title=
attribute, or do you mean that the item’s Title value is not displayed on the post/page below the image itself?
If you want to add a title=
attribute to the < IMG >
tag you can use an [mla_gallery]
shortcode to do that, but you would need the ID value of the item you want to display. You could also use the item Title in a caption for the displayed image. If you want more details on this solution, let me know. You should know, however, that WordPress deliberately removed the title=
attribute from their code several versions back because they consider it obsolete.
Your code example shows the IMG tag but not the markup that surrounds it. For reference, here is the code WordPress generates for three variations of image insertion:
[caption id="attachment_6493" align="alignnone" width="200"]<img class="size-medium wp-image-6493" src="https://l.mladev/wp-content/uploads/2019/11/Chevrolet-Camaro-muscle-car-wallpaper-phone-HD-200x300.jpg" alt="two one" width="200" height="300" /> two one[/caption]
<!-- wp:image {"id":6497,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://l.mladev/wp-content/uploads/2019/11/Ferrari-sports-car-picture-2018-1-1024x683.jpg" alt="one two three" class="wp-image-6497"/><figcaption>one two three</figcaption></figure>
<!-- /wp:image -->
<!-- wp:gallery {"ids":[6496]} -->
<figure class="wp-block-gallery columns-1 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="https://l.mladev/wp-content/uploads/2019/11/BMW-M1-Procar-red-race-car-Le-Mans-1024x683.jpg" alt="one two" data-id="6496" data-full-url="https://l.mladev/wp-content/uploads/2019/11/BMW-M1-Procar-red-race-car-Le-Mans-scaled.jpg" data-link="https://l.mladev/bmw-m1-procar-red-race-car-le-mans-scaled/" class="wp-image-6496"/><figcaption class="blocks-gallery-item__caption">one two</figcaption></figure></li></ul></figure>
<!-- /wp:gallery -->
The first insertion was performed inside a “Classic” block, the second in an “Image” block and the third in a “Gallery” block. All of them include a class="wp-image-...
attribute that gives the ID value of the item in question. None of them use the item’s Title value in any way, as Josh pointed out.
I will leave this topic unresolved for now. Please let me know how you want to use the Title in your application; any additional details you can provide will be helpful. Thanks for your interest in the plugin.