Support » Plugin: Media Library Assistant » Image Title from Media Library insert to the Post …. Image Title is not added

  • Resolved liaris

    (@liaris)


    Hi and thanks for the amazing plugin.
    Please help me – General Question (not only about the plugin)
    I can’t understand this:
    If i have one image with “title text” and “alt text” in our media library
    example image in media library

    If i edit a post and choose “add media” button and add the image inside post editor… in the html code i see

    <img src="https://www.domain.gr/wp-content/uploads/2020/04/icon-128x1281-1.png" alt="This Is Alternative Text for Image" width="128" height="128" class="alignnone size-full wp-image-238" />

    As you can see in the code, there is the “alt text” but not the “title text” (from media libary)

    Why WP doesn’t add the “title text” ?

    Is this happening for seo reasons ?

    I mean is this happening becaouse the admin can (or must) add his own “image title” depending on theme-content of the post?

    Thanks… and i hope someone can help me .. understand why is this happening.

Viewing 6 replies - 1 through 6 (of 6 total)
  • This is standard WP behavior without MLA. The alt attribute only gets populated from an image’s alt title, title attribute is neither used in [gallery] nor casual image insertion. Your best option is to setup mapping rules so that an image alt is inherited from it’s title. Go to MLA > IPTC/EXIC > Alt text. Set it’s priority to IPTC, template value to template: [+post_title+], and enable. You should see image titles added to an image alt.

    Plugin Author David Lingren

    (@dglingren)

    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="http://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="http://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="http://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="http://l.mladev/wp-content/uploads/2019/11/BMW-M1-Procar-red-race-car-Le-Mans-scaled.jpg" data-link="http://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.

    liaris

    (@liaris)

    Thanks for your answers.
    I mean the < IMG > tag does not include a title=attribute (that’s why it’s not displaying in users)
    I didn’t know that WordPress had deliberately removed it.
    But i have an inquiry, why do they removed it as it still remains a factor of SEO?

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your clarification.

    You wrote “(that’s why it’s not displaying in users)“. As far as I know, the “title” attribute in an < IMG > tag is not displayed when present. In a hyperlink it is sometimes displayed when the mouse hovers over the link. WordPress uses the Caption value, not the Title value to compose the content seen by the user.

    For SEO, the alt= attribute is used; I don’t know that a title= attribute would have much effect. Of course, I am not an SEO expert.

    WordPress removed the title= attribute from the thumbnail images generated for the [gallery] shortcode back in version 3.7. As I recall, they wrote that it was no longer used for screen reading software and had been replaced by the Accessible Rich Internet Applications (ARIA) standards.

    If you want to experiment with adding title= values to your post/page inserts you can try the “Post/Page Item Insert Modification” tools in the “MLA Insert Fixit” example plugin. If you want to experiment with the existing tools you can easily install the example plugin. Navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. You will see a submenu that lists all the example plugins and gives you a “one-click” action for installing them.

    Type “fixit” into the search box and click “Search Plugins”. You are looking for “MLA Insert Fixit” plugin. Find that plugin and hover over the title in the left-most column. Click the “Install” rollover action, then go to the WordPress Plugins/Installed Plugins submenu and activate it.

    Once that’s done, navigate to the Tools/Insert Fixit screen and scroll down to the “Post/Page Item Insert Modification” tools. Enter [+post_title+] in the Data Source text box and title in the Attribute Name text box. You can click the “Add Attribute” tool to apply it to all of your posts/pages, or you can use the “First Post/Page ID” and “Last Post/Page ID” text boxes at the top of the screen to test it out on one or a few of your posts/pages.

    I am marking this topic resolved, but please update it if you have problems or further questions regarding the above explanations or suggestions.

    Hello David! I have a question not related to your plugin, sorry, but it’s about WP titles.

    I used to fill titles since 2015, leaving alt empty. Why? Inserting photos like DCIM_1234_01_02_2015.jpg automatically put this filename to “title” field. So I just changed this name to some relevant text AND it did show up in Lightbox/Colorbox when users open full-screen image.

    Now I’ve updated) Gutenberg… It has problems. But. All my old posts, made in classical editor, now shows same POST TITLES instead of title from medialibrary.

    * only galleries, single images in old posts kept title for some reason

    I mean that before update users could see some additional info about every photo – my title description. Now it is not showed.

    I think I should transfer this title to alt field somehow. But what is the right way to do this? I have thousands of photos, need some bulk method.

    Can you please give me advice? Thanks in advance

    Plugin Author David Lingren

    (@dglingren)

    @vigilant_spb

    Thanks for the question, but it’s not related to the earlier posts in this topic. Please start a new topic, give it a good title, and copy the text from your post above to the new topic. I have some ideas but need more information.

    Thanks for your understanding.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.