WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] Galleries images no longer showing Alt Text (7 posts)

  1. piantadosi
    Member
    Posted 1 year ago #

    Great plug-in, RavanH. Upgraded to 1.5.0 on our dev site and after figuring out how to stop our theme from hijacking the gallery shortcode into its own Lightbox routine (because we really do like your way better), I noticed that gallery images now only show the Title and no longer the Alt Text (although the "Allow title from thumbnail alt tag" setting works as expected with single images in posts; this only happens with galleries).

    Am I missing something? If not, any ideas?

    http://wordpress.org/extend/plugins/easy-fancybox/

  2. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Hi piantadosi, the option "Allow title from thumbnail alt tag" is just what it says. It allows a title to be taken from the ALT attribute but FancyBox will always prefer the TITLE attribute. Only if there is no title available + the "allow title from alt" option is set, the alt attibute will be used... This was already the case in the last version and has not changed in the new version.

    So it looks like your gallery images all have a (link tag) title attribute.

  3. piantadosi
    Member
    Posted 1 year ago #

    Sorry I wasn't clear or maybe I'm not understanding something (or maybe this is a theme function) but . . .

    Until 1.5.0, if I checked the "Allow title from alt tag" option, when img tags were generated, whatever we had in the Alt Text field in the WP media editor/uploader would be substituted for what was in the Title field -- whether or not the Title field was empty. And if there was no text in the Alt Text field, even with the option turned on, the alt attribute value was set to what's in the Title field. (So we spent a lot of time editing over the last four years copying and pasting stuff from the Caption field to the Alt Text field.)

    In the new version, this behavior (basically, use Alt Text if it exists) still happens with single or multiple images embedded in a post. (Meaning even if there's text in the Title field, the img tag is generated with an alt attribute that clearly came from Alt Text field.) But it doesn't happen with img tags generated by the gallery shortcode -- with those, now I have to delete all the text in the Title field for it to use the Alt Text.

    So I'm just wondering if I have to delete the contents of the Title field in the WP image editor for like 300 images or not. If so, it's fine, your plug-in is worth it -- it just seemed like something had changed.

  4. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    piantadosi, my plugin does not interfere with the normal WordPress functions. When you fill in an alt text field and it gets used as title attribute (or the other way around) it is due to another plugin.

    Did you recently start using Jetpack with any of the media/gallery related modules activated by any chance? The behaviour you describe sounds like it could come from that one...

    Can you share a link to your site, so I can have a look?

  5. piantadosi
    Member
    Posted 1 year ago #

    Thanks, I was starting to think it was something else. It's not the theme; I activated Twenty-Twelve and the behavior's exactly the same as I described. I'm not using Jetpack or any other specifically media-related plugins, so . . . I'm stumped.

    If you have time for a look, there's a normal post (with images) here and a post with a two-photo gallery in it here. On both pages, the first photo has no text in the Title field, and the second photo has text in all fields ("Title" in Title, "Caption" in Caption, "Alt Text" in Alt Text, etc.)

    Thanks again,
    Roger

  6. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Open the post http://dev.rappnews.com/2013/05/23/at-castleton-its-homes-away-from-home/121386/ for editing, then (in the View tab) click the second image and then the Edit Image icon. Is there a title in the Title field there?

    UPDATE: It seems you have found a change in the WordPress method of inserting single images into posts, that I was not aware off. Apparently, to set a link title attribute (which FancyBox uses by default) you will have to open the image for editing (see above) and then switch to the Advanced tab and find the the Advanced Link Settings section. Set a title there.

    This is not something that is managed by my plugin and I'm afraid you'll have to do that manually for each single image...

    Alternatively, you could add some javascript (in a text widget or footer.php) to do this for you on each page load:

    <script type="text/javascript">
    jQuery("div.entry-content a img").each(function() {
      var $this = jQuery(this);
      $this.parent().attr('title', $this.attr('title'));
    });
    </script>
  7. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Or, if you actually want it the other way around (the images in the gallery to always use the Alt text) then use this script snippet instead:

    <script type="text/javascript">
    jQuery("div.gallery a img").each(function() {
      var $this = jQuery(this);
      $this.parent().attr('title', $this.attr('alt'));
    });
    </script>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic