Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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,
    Lucia

    #1324132

    Hi 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,
    Yigit

    #1372259

    Thanks 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?

    #1372271

    Hi 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,
    Rikard

    #1372279

    Rikard, 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?

    #1372289

    Hi hmsvictory,

    I’m not aware of any such plugins unfortunately.

    Best regards,
    Rikard

    #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.

    #1372361

    if 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');
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘How to remove filename which shows when mouse arrow is on a picture’ is closed to new replies.