Feature request: make caption clickable
-
My request is to make the caption that appears on top of the image clickable, just like the image. So to put the caption code inside the link code. Not only would it allow the caption to be clickable (which makes sense from the user’s point of view), it would also allow for css hover animations (captions appearing on hover for example).
Could you add this feature to your plugin?
I succeeded in putting the caption inside the link by editing the plugin file (taking inspiration from the default gallery, which does this), but my changes will be lost when I update the plugin.
Here is the code that I used, inside gallery-owl-carousel.php. The two corrections are marked by the comments “sam:”:
<div class="foo-item" <?php echo $dohash ; ?>> <?php $cap = $attachment->caption; $desc = $attachment->description; //the image instance // sam: added true false. Not sure what they mean... echo $attachment->html( $args, true, false ); // show caption if it exists // basically, if both caption and description are empty, show nothing here // otherwise, check if either exists then show it if( $showdesc == true ) { if( (empty($cap) ) && ( empty($desc)) ) { } else { ?> <div class="owl-caption"> <?php if( !empty($cap) ) { ?> <h4><?php echo $cap ; ?></h4> <?php } if( !empty($desc) ) { ?> <p><?php echo $desc ; ?></p> <?php } ?> </div> <?php } ?> <?php } ?> <?php // sam: added close link echo '</a>'; ?> </div>Thank you.
The topic ‘Feature request: make caption clickable’ is closed to new replies.