Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1050602

    Hi

    I have been trying to remove the title from an image when hovering over it using the following in the functions php file however it doesn’t appear to be working

    function remove_title_attr(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(‘#wrap_all a’).removeAttr(‘title’);
    jQuery(‘#wrap_all img’).removeAttr(‘title’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘remove_title_attr’);

    #1050626

    Hey info224,
    Your url is not complete, so I couldn’t see you site, but your function looks about right unless the image is before the wrap_all ID, or if you have another jQuery error on your site, which would block this from working.
    Would you want this to work on only one image or all of them?
    Please include a admin login in the Private Content area and let us know which image you want the title removed from.

    Best regards,
    Mike

    #1051358

    Hi

    I was hoping for a general catch-all although I’m now thinking that for SEO purposes it might be better to have them. I’m not sure.
    Details are below

    Thanks

    • This reply was modified 5 years, 10 months ago by info224.
    #1051380

    Hi,
    Thank you for the login, I checked your homepage and found that your script is working good, I also conformed it by removing the script and testing, which showed the titles.
    Perhaps you need to clear your browser cache.
    Or perhaps there is one image on another page that this is not working with, which if you point it out we can help adjust it.

    SEO and accessibility screen readers use the title tag, in which the best option is to adjust each title to explain what the image is, yet many choose to remove them. It’s up to you.

    Best regards,
    Mike

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