Hide image title when mouseover in product archive

This topic has 8 replies, 2 voices, and was last updated 7 years, 11 months ago ago by Eva Kemp

  • Avatar: Royalty
    Royalty
    Participant
    December 12, 2016 at 20:29

    Hello,
    is there a way to prevent the image title from showing up at mouseover?
    many thanks in advance!

    7 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    December 12, 2016 at 20:49

    Hello,

    Add this code in footer.php file before </body> tag:

    <script type="text/javascript">
    jQuery(document).ready(function($){
    jQuery('img').removeAttr('title');
    });
    </script>

    Regards,
    Eva Kemp.

    Avatar: Royalty
    Royalty
    Participant
    December 12, 2016 at 20:50

    Thank you very much for your soon reply! Is it possible to modify this code to use it in functions.php instead?

    Avatar: Eva
    Eva Kemp
    Support staff
    December 12, 2016 at 21:01

    Hello,

    You can create child theme and add footer.php file to the child theme. This way you won’t lose modifications after theme update.

    Regards,
    Eva Kemp.

    Avatar: Royalty
    Royalty
    Participant
    December 12, 2016 at 21:03

    Yes I know but I dont want to add to many template files into my childtheme. I always prefer to use functions.php of my childtheme for modifications. So, isn’t there a way to achieve this via functions.php?

    Avatar: Eva
    Eva Kemp
    Support staff
    December 13, 2016 at 19:51

    Hello,

    Please try this code in functions.php file:

    function add_custom_script(){
    ?>
    <script>
    jQuery(document).ready(function($){
    jQuery('img').removeAttr('title');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Regards,
    Eva Kemp.

    Avatar: Royalty
    Royalty
    Participant
    December 14, 2016 at 08:59

    Works perfect, thank you very much!

    Avatar: Eva
    Eva Kemp
    Support staff
    December 14, 2016 at 09:11

    Hello,

    You’re welcome.

    Regards,
    Eva Kemp.

  • Viewing 8 results - 1 through 8 (of 8 total)

The issue related to '‘Hide image title when mouseover in product archive’' has been successfully resolved, and the topic is now closed for further responses

8theme customization service

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.