Title: Feature request: make caption clickable
Last modified: January 15, 2017

---

# Feature request: make caption clickable

 *  [Samuel](https://wordpress.org/support/users/sambody/)
 * (@sambody)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/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.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Matt Cromwell](https://wordpress.org/support/users/webdevmattcrom/)
 * (@webdevmattcrom)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/feature-request-make-caption-clickable/#post-8661153)
 * Thanks for your code contribution! I’ll test this out and see what I can come
   up with.
 * Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Feature request: make caption clickable’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/foogallery-owl-carousel-template_1cc9cd.
   svg)
 * [FooGallery Owl Carousel Template](https://wordpress.org/plugins/foogallery-owl-carousel-template/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/foogallery-owl-carousel-template/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/foogallery-owl-carousel-template/)
 * [Active Topics](https://wordpress.org/support/plugin/foogallery-owl-carousel-template/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/foogallery-owl-carousel-template/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/foogallery-owl-carousel-template/reviews/)

## Tags

 * [owl](https://wordpress.org/support/topic-tag/owl/)

 * 1 reply
 * 2 participants
 * Last reply from: [Matt Cromwell](https://wordpress.org/support/users/webdevmattcrom/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/feature-request-make-caption-clickable/#post-8661153)
 * Status: not resolved