-
AuthorPosts
-
October 8, 2021 at 3:27 pm #1324129
Dear Enfold Support,
I am using Enfold Child theme. When I put a mouse arrow over a picture, it shows a filename of that picture. How to remove it completely?
Best regards,
LuciaOctober 8, 2021 at 3:30 pm #1324132Hi Lucia,
Thanks for contacting us!
Please add following code to bottom of Functions.php file of your child theme – https://kriesi.at/documentation/enfold/child-theme/
function remove_title_attr(){ ?> <script> jQuery(window).load(function(){ jQuery('#wrap_all a').removeAttr('title'); jQuery('#wrap_all img').removeAttr('title'); jQuery('.av-masonry-image-container').removeAttr('title'); }); </script> <?php } add_action('wp_footer', 'remove_title_attr');
Regards,
YigitNovember 11, 2022 at 8:03 pm #1372259Thanks Yigit. I used to think the title attribute was important for SEO but from what I am reading lately, it appears that the ALT tag is what matters, the title attribute is not considered in the search algorithm anymore?
November 11, 2022 at 9:47 pm #1372271Hi hmsvictory,
We’re not really SEO experts, but I think the title attribute plays a role in SEO results, as well as the alt tag.
Best regards,
RikardNovember 11, 2022 at 11:33 pm #1372279Rikard, I think you are right. I guess I need to keep the title attrbute.
Is there a plugin that you prefer to bulk edit image titles and alt attributes in the media library?
November 12, 2022 at 11:41 am #1372289Hi hmsvictory,
I’m not aware of any such plugins unfortunately.
Best regards,
RikardNovember 12, 2022 at 10:27 pm #1372354@hmsvictory
In the media library changing the title and alt text is possible per image.I use this plugin which includes a bulk updater based on file name.:
https://wordpress.org/plugins/auto-image-attributes-from-filename-with-bulk-updater/If you upload the images named what you want the text to say then this plugin will automatically use this to create a title and alt tag. Best practice is to upload images with file names that reflect the content anyway. Just as a final bit of info for search engines to cross reference against.
The difference between title and alt tag
“alt” is for providing an image alt tag to describe the image to the search engine crawlers and the screen readers for better web accessibility.
“title” is for providing an explanation of the image alt tag and image URL within the “src” attribute.Alt tags are used by search engines and for accessability. Titles are used to provide more detail than alt tags and also displayed to the user on hover.
If they are both the same it isnt an issue. I would keep the title tags for SEO purposes but also get into the habit of uploading images named to reflect what they contain.
November 12, 2022 at 11:25 pm #1372361if you do not want to completely remove the titles – just do that on mouseover:
( play a bit with the selectors – maybe it is not useful to have that for all elements with titles )function temporary_removal_title_tags(){ ?> <script> window.onload = function() { var links = document.querySelectorAll('a, img, *[title]'); for (var i = 0; i < links.length; i++) { var link = links[i]; link.onmouseover = function() { this.setAttribute("data-tooltip", this.title); this.title = ""; }; link.onmouseout = function() { this.title = this.getAttribute("data-tooltip"); }; link.onmousedown = function() { this.title = this.getAttribute("data-tooltip"); }; } }; </script> <?php } add_action('wp_footer', 'temporary_removal_title_tags');
-
AuthorPosts
- The topic ‘How to remove filename which shows when mouse arrow is on a picture’ is closed to new replies.