• I have spent an entire working day to figure out how I can create a thumbnail gallery with the captions appearing when I hover over the pictures, but also appearing below the pictures when the gallery turns into a slideshow. This worked really well on wordpress classic and I have it operational on another website (like here: https://agencyofimagination.org/artist-residencies/). So I tried to do it on this new site as well (using squaretype template), as in adding a block in classic mode and then creating a gallery from media. But here all the captions come as text below the pictures and not when you hover over them. I have also tried to download several different plugins to try and implement this desired feature. And none of the ones I’ve tried have had both the hover effect and the captions featuring as the gallery turns into a slide show. And some of them are not very user friendly. Since this is a non-for-profit art project we cannot afford to pay subscription fees for a few galleries on our website, so no fancy options are possible. I am so sad that this feature has disappeared from the newer WordPress version. Any advice would be very welcome! Especially if I can implement it on the already excisiting galleries. Thank you!

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 21 total)
  • I think your problem probably requires a CSS based solution. Include the following CSS in your style.css file at the bottom to avoid overriding issues.

    figcaption.wp-element-caption { display: none; }

    figcaption.wp-element-caption:hoverΒ { display: block;

    background-color: #80808096 !important; /*Adjust Color*/

    }

      Thread Starter evatheweaver

      (@evatheweaver)

      Great! Thank you so much! I will certainly try this. I am not very good, to say the least, with CSS and HTML. Do I copy and paste this into the right hand bottom bit of this particular post or in a more general place?

      In your theme file , I believe ,style.css file should be present. Paste these code over there at the bottom. Unless something is overriding the given codes, these should show caption on hover over the image. I hope this helps.

      Thread Starter evatheweaver

      (@evatheweaver)

      I found it under custom theme and pasted it in, but sadly there must be something overiding it πŸ™ As nothing changes on the gallery post πŸ™

      Moderator threadi

      (@threadi)

      Try this CSS:

      .wp-block-image figcaption { display: none;background-color: #80808096 }
      .wp-block-image:hover figcaption { display: block }

      Add this in backend under Appearance > Customizer > Additional CSS. And remove the code from above, it does not work.

      Thread Starter evatheweaver

      (@evatheweaver)

      Thank you! I will remove the previous code and paste this one in its place to see what happens.

      Thread Starter evatheweaver

      (@evatheweaver)

      I tried but sadly this did not work either. Perhaps there is a conflict somewhere πŸ™

      Moderator threadi

      (@threadi)

      You have inserted the code in the wrong place. Namely in the field for CSS classes in the gallery. It can’t work there either.

      Please insert the code as I have described here:

      Add this in backend under Appearance > Customizer > Additional CSS.

      Thread Starter evatheweaver

      (@evatheweaver)

      Well, I did actually paste it exactly where you said: Appearance > Customizer > Additional CSS.

      And I removed the previous code. When this did not work I also added it to the CSS classes in the gallery. This did not work either, so I removed this. It might be that I have something else in the CSS setting that conflicts? This is what is there already:

      colophon{

      background-color:#000;}

      menu-footer.navbar-nav > li > a {color:#fff;}

      .entry-header .page-title, content > .entry-header .entry-title {

      font-size: 22px;

      }

      .wp-block-image figcaption { display: none;background-color: #80808096 }
      .wp-block-image:hover figcaption { display: block }

      Moderator threadi

      (@threadi)

      I still do not see any output of the two lines in the frontend. But I can see what else you mentioned, only here in full in the code block:

      #colophon{
      background-color:#000;}

      #menu-footer.navbar-nav > li > a {color:#fff;}
      .entry-header .page-title,
      #content > .entry-header .entry-title {
      font-size: 22px;
      }

      Below that you would have to add the 2 lines I mentioned. They are missing right now.

      Thread Starter evatheweaver

      (@evatheweaver)

      #colophon{
      background-color:#000;}

      #menu-footer.navbar-nav > li > a {color:#fff;}
      .entry-header .page-title,
      #content > .entry-header .entry-title {
      font-size: 22px;
      }
      <?php echo do_shortcode('[iheu_ultimate_oxi id="5"]'); ?>
      .wp-block-image figcaption { display: none;background-color: #80808096 }
      .wp-block-image:hover figcaption { display: block }

      These are the codes inserted. With the two lines from you. But sadly it has not solved my problem.

      Is it still something wrong in the way I have pasted in the code?

      Thank you all the same!

      Moderator threadi

      (@threadi)

      Why do you have PHP code in the middle of it? It doesn’t belong there. Delete this line:

      <?php echo do_shortcode('[iheu_ultimate_oxi  id="5"]'); ?>

      The field may only contain CSS code. Presumably this PHP code prevents the CSS code from being executed in full, which could explain all the problems.

      Thread Starter evatheweaver

      (@evatheweaver)

      YES! That made the difference! Thankyou so much for persevering!

      But I was hoping this code would affect all the galleries, also on the other pages and posts. Or does it just do it on this particular post?

      Like on this page for instance, that has not got the hover effect.: https://theconferenceofthebirds.net/nests-2/norway/

      And I cannot understand why this post has not got it: https://theconferenceofthebirds.net/nests/norway-ahoo-ahoo/docks-down-and-ducks-at-sea/

      When this one has: https://theconferenceofthebirds.net/nests/nest2/sensing-birdpoetic-worlds/

      • This reply was modified 1 year, 1 month ago by evatheweaver.
      • This reply was modified 1 year, 1 month ago by evatheweaver.
      Moderator threadi

      (@threadi)

      Glad it works now πŸ™‚

      No, the code applies to every image with a caption. I don’t see any caption on the images on the other page. I think you have to add them there first.

      Thread Starter evatheweaver

      (@evatheweaver)

      Yes, I am so happy that some of them works now! I really appreciate it. Thank you!

      But I cannot understand why it is not working on all of them. I have now checked and tried to add captions on most of the ones from this page and it sadly does not work πŸ™ https://theconferenceofthebirds.net/nests-2/norway/

      or here: https://theconferenceofthebirds.net/nests/seminars-and-symposium/can-people-and-birds-become-friends/

    Viewing 15 replies - 1 through 15 (of 21 total)

    The topic ‘WordPress Gallery with hovering captions’ is closed to new replies.