• Resolved ccompton

    (@ccompton)


    Is it possible to display the alt text of an image when hovering over it in the gallery? I didn’t see it in settings, but it seems like basic functionality.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The reason is, there is simply no alt-attribute on each img-tag, an embarrassing error. This issue breaks also the W3C HTML validation rules. It would be cool, when it will be fixed with the next update. Thanks in advance.

    • This reply was modified 7 years, 11 months ago by neralex.

    I found a way to fix it.
    open ‘includes/class-foogallery-attachment.php’ and find:

    if ( ! empty( $this->alt ) ) {
        $attr['alt'] = $this->alt;
    }

    replace it with:

    # fixed: validation issue - missing alt-argument 
    if ( ! empty( $this->alt ) ) {
        $attr['alt'] = $this->alt;
    } else {
        $attr['alt'] = '';
    }
    # added: set title-argument 
    if ( ! empty( $this->title ) ) {
        $attr['title'] = $this->title;
    }
    • This reply was modified 7 years, 11 months ago by neralex.
    • This reply was modified 7 years, 11 months ago by neralex.
    Thread Starter ccompton

    (@ccompton)

    That worked. Thanks! Definitely agree this needs to be fixed in the next version.

    • This reply was modified 7 years, 11 months ago by ccompton.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Displaying alt text on hover’ is closed to new replies.