Our client has requested that we remove all of the ‘tooltips’ that show up with image titles. Do you have a suggestion for removing these, without actually having to remove the “title” elements?
Site is http://gochronicle.com
Submitted by Chuck Gregory, developer for Barbara Deckmeyer
Hey Chuck!
There is no way to remove the titles without actually remove them. However, i guess you want to keep them for SEO reasons, if that’s the case the following code would be enough as web crawlers don’t run javascript:
function add_custom_script() { ?>
<script>
jQuery(window).load(function(){
jQuery("img").removeAttr('title');
});
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
Regards,
Josue
Thanks. I added a couple lines at top and created a functions.php in my child theme:
<?php
function add_custom_script() { ?>
<script>
jQuery(window).load(function(){
jQuery(“img”).removeAttr(‘title’);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘add_custom_script’);
Hey!
Yes, i forgot that on my initial code. Did it work?
Cheers!
Josue