• Resolved unalignedcoder

    (@unalignedcoder)


    The popup of the image shows the “title” tag, but in a regular wp gallery the title is nothing but the name of the pic minus the extension.

    Problem is, most users will add a meaningful description to the image in the “caption” field, which corresponds to post_excerpt, leaving the title field alone, because this is pre-filled by WP.

    I think this plugin should show the caption on mouse over (or below the pic), not the title.

    (on an unrelated note, it seems that margin-left in #fancybox-title is not necessary, as it sends the title off to the right by ten pixels.)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    Not sure what you mean when you say “it should show”. The plugin is meant to show a title on mouse-over, and that is what it shows. Are you asking for a feature to be able to show the caption on mouse-over?

    but in a regular wp gallery the title is nothing but the name of the pic minus the extension.

    In a regular WP gallery, the title and caption are both editable fields. If you look at the standard WP “Add media” behavior, the title (never the caption) is used to populate the “title” attribute on links, which shows up when you hover over an image, or, in devices for the blind, shows up in the “alt” attribute. This behavior is consistent between Photonic and WP. In fact, in WP the caption only kicks in if the caption field is populated (which triggers the caption shortcode), and even then the title is what is used for the link title and image alt. In every scenarios WP uses the title, and it only uses the caption when present, that too in a limited manner.

    Problem is, most users will add a meaningful description to the image in the “caption” field, which corresponds to post_excerpt, leaving the title field alone, because this is pre-filled by WP.

    That is debatable. For every user you show me that uses captions and not the title, I can show you a user that ignores the caption altogether in favour of the title, and I can show you another user that uses both.

    But, back to my original question: are you looking for help in displaying a caption? Can you help me with answers to the following?

    1. What type of provider – Flickr, Smugmug, Zenfolio, 500px, Picasa, or Instagram?
    2. What type of layout – embedded in a page or in a lightbox? Note that for the cases where the shortcode supports single-image display, the caption is already shown. See http://aquoid.com/news/plugins/photonic/flickr/flickr-photo/, or http://aquoid.com/news/plugins/photonic/zenfolio/photos/, or “Enjoying the sunshine” here: http://aquoid.com/news/plugins/photonic/500px/. Also, in case the title is empty, for each of the providers the caption is displayed in the lightbox or on mouse-over.
    3. Which lightbox – Swipebox, PrettyPhoto, Colorbox or Fancybox?
    Thread Starter unalignedcoder

    (@unalignedcoder)

    Thanks for the answer. You sound a bit defensive? probably it’s my fault as I rushed with my post, so let me clarify: what I meant to say is that, when it comes to the regular WP gallery, in my opinion it would be a better behaviour if the popup took from the Caption field rather than the Title field.

    As I said, when my users make a regular WP gallery, they fill in the caption field, because this was what you would do in the regular wordpress gallery in order to see the caption. The title field they’d leave it alone because it comes pre-filled by WP with the name of the picture.

    To come to your question, I am talking about the regular WP gallery (no external providers),the gallery is embedded in a page or post, and the lightbox effect is Fancybox.

    I’ll appreciate any help you can give. I tried going into the code to replace ‘title’ with ‘post_excerpt’ but I couldn’t make it work.

    Plugin Author Sayontan Sinha

    (@sayontan)

    Are you using a child theme / custom theme? If so, are you familiar with the use of filters?

    I am adding this to the plugin, in the file photonic.php, after line 654, and line 679:

    $title = apply_filters('photonic_modify_title', $title, $attachment);

    If you have a child / custom theme, you can perform these steps:

    1. Make a call to add_filter in your child / custom theme’s functions.php, and add a filter for photonic_modify_title this way:
      add_filter('photonic_modify_title', 'my_theme_photonic_modify_title', 10, 2);
    2. Then, create a function my_theme_photonic_modify_title this way:
      function my_theme_photonic_modify_title($title, $attachment) {
      	return empty($attachment->post_excerpt) ? $title : wptexturize($attachment->post_excerpt);
      }
      

    Since I will be adding the filter hook photonic_modify_title to the plugin code, your edits will be upgrade-safe if you follow the above approach.

    If you are not using a child / custom theme, you can modify the plugin directly by changing line 650 and line 675:

    $title = wptexturize($attachment->post_excerpt);

    This change is not upgrade-safe, so everytime the plugin is upgraded you will have to redo the change.

    Thread Starter unalignedcoder

    (@unalignedcoder)

    Dear Sayontan, thanks! Your solution worked! (after I manually updated the galleries). You’ve been very helpful.

    If you don’t mind, one extra thing: In tile mode the only “popups” that seem to work are the HTML popup and the JQuery tooltip. The other ones just won’t apply. Is there any solution to this? I’d love to be able to use the “slide up from bottom” popup.

    Plugin Author Sayontan Sinha

    (@sayontan)

    Looks like an oversight at my end, which I will fix for the next version.

    This is the code:

    1. Right after you added the title code in line 680, put in this code:
      
      $shown_title = '';
      if (in_array($photonic_wp_thumbnail_title_display, array('below', 'hover-slideup-show', 'hover-slidedown-show')) && $title != '') {
      	$shown_title = '<div class="photonic-title-info"><div class="photonic-photo-title photonic-title">'.wp_specialchars_decode($title, ENT_QUOTES).'</div></div>';
      }
      
    2. Then, a few lines later, you have this code:
      
      $ret .= "<a href=\"".$src[0]."\" rel='$rel' title='$title' $slideshow_library_class><img src='".$src[0]."' alt='$title' /></a>";
      

      Replace it with:

      
      $ret .= "<a href=\"".$src[0]."\" rel='$rel' title='$title' $slideshow_library_class><img src='".$src[0]."' alt='$title' />$shown_title</a>";
      
    Thread Starter unalignedcoder

    (@unalignedcoder)

    This worked! Thanks a lot! For the next version also don’t forget to check the fancybox js as I mentioned in my first post…

    where it says

    switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});

    I found I needed to comment out the “marginLeft” attribute, which otherwise in my case would cause the caption to be offset to the right:

    switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,/*marginLeft:d.padding,*/marginRight:d.padding});

    That’s all. This is a great plugin. The only one which allowed me to keep the standard wordpress galleries while getting a better layout for them. So thank you for it )

    [EDIT: actually, if I use the ‘slide up’ caption, the fancybox caption in the slideshow disappears completely?]

    Thread Starter unalignedcoder

    (@unalignedcoder)

    …I corrected the problem I last mentioned by commenting out line 1059 in photonic.js:

    $(this).attr('title', '');`

    Plugin Author Sayontan Sinha

    (@sayontan)

    I don’t believe any of the Fancybox issues are issues with Fancybox itself, rather they are conflicts between Fancybox and the specific theme you are using. E.g. If I use the WP Twenty* themes I see an issue, because the WP themes force box-sizing: border-box on everything, while Fancybox is designed to work with box-sizing: content-box. If, for example, you use a theme like Customizr, or Responsive, you wouldn’t see any alignment issues.

    Of course, the right fix for this is to code something like this in your child theme’s CSS (I will put this in Photonic’s code):

    #fancybox-wrap, #fancybox-content { box-sizing: content-box; }

    Regarding the second point you mentioned, that doesn’t seem like the correct fix. That code is there for a very specific purpose (so that you don’t get the standard title upon hovering). Do you have a link where I could troubleshoot?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘popup title shows ‘title’, but it should show ‘caption’’ is closed to new replies.