How To Replace Alt Text With Titles
-
Hi
I think your plugin can help but I’m struggling to work out how to use it.
I want to replace all my alt tags with the info that’s in my title tags for my media.
I don’t understand your custom field mapping. Would it be possible for you to do a step 1,2,3 type answer so I can see how it works?
I.e. what do I put in these fields?
https://screencast.com/t/AbCO9rV3Any help is appreciated!
-
Thanks for your question and for the link to your screen shot. I know that the mapping rule features of MLA can be complex.
You wrote “replace all my alt tags with the info that’s in my title tags …“. I understand that to mean you want to replace the WordPress standard “Alternate Text” field (ALT Text) with the value in the “Title” field and the terms assigned to the item in the “Att. Tags” taxonomy; is that right?
You are on the right track but the rules in your screen shot are for populating custom fields. The ALT Text field requires a rule to be added in the IPTC/EXIF tab.
You can use a mapping rule with a Content Template to populate the WordPress ALT Text value from the item’s other fields:
- Navigate to the Settings/Media Library Assistant IPTC/EXIF tab.
- Scroll down to the Alternate Text line of the Standard Field Mapping section.
- Leave the IPTC Value set to the default “None” value.
- Enter “template:[+post_title+](, [+terms:attachment_tag+])” in the text box under the EXIF/Template Value heading.
- Set the Priority dropdown control to EXIF and the Existing Text dropdown to Replace.
- Scroll to the bottom of the screen and click “Save Changes” to record your settings.
Once that’s done you can use the Map All Attachments, Standard Fields Now button to go back and set the ALT Text field for your existing items, if that is appropriate. You can use the Media/Assistant Bulk Edit area or the Media/Edit Media screen to make more selective replacements. Look for the Map IPTC/EXIF Metadata button on either of those screens.
I encourage you to go to the Edit Media screen for one of your images and test the rule before you apply it to all of your images.
This solution will update the ALT Text field whenever you manually run the rules. When you add new images or change the terms assigned to an image you must re-run the rule to build the ALT Text field again. After you add new images and assign terms to them you can use the Media/Assistant Bulk Edit area to run the rules for several images at once.
If I did not understand your question correctly any additional details you can provide will be very helpful. Thanks for your interest in the plugin.
-
This reply was modified 8 years, 5 months ago by
David Lingren.
Hi David
This is such a neat feature!
Is there a way to have it auto capitalise the alt or title text on a bulk update?
Kind Regards
ALexThanks for the kind words and for your new question.
You can use the hooks provided by MLA to customize the handling of updates in a Bulk Edit update. Here is an earlier topic with an example that adds a sequence number to the item Title to make it unique:
Counter in title for multiple upload images
With a bit of PHP coding you could implement whatever auto capitalization makes sense in your application. Access to example plugins has changed since that topic was written. To find the example plugin, navigate to the Settings/Media Library Assistant Documentation tab and click the new “Example Plugins” button. Enter “bulk” in the text box and click “Search Plugins”. You should see the example plugin.
The “MLA Upload Bulk Edit Example” plugin is the one you want. You can hover over the plugin name and click the “Download” rollover action to get a copy you can adapt to your needs. If you need more specific guidance, let me know.
It has been a couple of months since the last post in this topic. I hope you found the solutions you need for your application.
I am marking this topic resolved, but please update it if you have any problems or further questions about metadata mapping in MLA.
Hi @dglingren, the solution worked for me like a charm, I was able to include the Alt text tag to all my images, thanks a lot! but, I thought it would print the “Post Title”, instead it printed the “title tag” of the image.
I want to replace the WordPress standard “Alternate Text” field (ALT Text) with the value in the “Post Title” field.
What would be the template to use to print the article title into the the Alt text tag?
Thanks for your question. I want to make sure I understand what you are trying to do.
You wrote “Post Title” and “article title“. I understand that to mean you have images “attached” to a Post and you want to access the Title value of the parent post. Is that right?
If so, you can enter something like
template:[+parent_title+](, [+terms:attachment_tag+])
in the text box under the EXIF/Template Value heading. As you discovered,[+post_title+]
is the Title value for the image itself. That is a little confusing, but it is the name of the field in the database where the Title is stored.Note that
[+parent_title+]
is only defined for images “attached” to a post or page. If you want something in the ALT Text field for every one of your items you can use something liketemplate:([+parent_title+]|[+post_title+])
. That will use the parent title when it is available and default to the item’s Title for “unattached” items.David, that’s exactly what I needed and it worked flawlessly:
template:[+parent_title+](, [+terms:attachment_tag+])
Unfortunately for me, all images are unattached and using this solution:
template:([+parent_title+]|[+post_title+])
Will put the image name on the Alt text, like for example:
plugins-for-wordpress
Thankfully, your plugin does a great job by identifying each unattached image and providing the tools to attach each image to the post they belong. I will have to go post by post attaching each image to a post, so I can use the first template which works perfectly.
Thank you!
-
This reply was modified 7 years, 10 months ago by
Optimiza.
I was thinking if there’s a way with your plugin to replace the dashes that comes in
[+post_title+]
?That way I could use the
template:([+parent_title+]|[+post_title+])
plus the instruction to remove the dashes. ??I feel like I’m asking too much, sorry.
Thanks for your updates and the additional question. Replacing the dashes WordPress adds to the Title field (a temporary WordPress bug that has been corrected) has come up before. You can find a solution in this earlier topic and the topics it links to:
If you need more specific help, post an update here and I will follow up.
Thank you David, this gives me all the tools I need to finish what I need. No further questions, I really appreciate your help.
- The topic ‘How To Replace Alt Text With Titles’ is closed to new replies.