Title: Caption with additional button
Last modified: August 24, 2016

---

# Caption with additional button

 *  Resolved [Gerald](https://wordpress.org/support/users/gerital/)
 * (@gerital)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/caption-with-additional-button/)
 * I needed to add a button with a link in addition to title and caption. My quick
   and dirty solution abuses the description field and its possibility to save content
   as html. So you can put something like this into your media description field:
 * `<a class="register-button" href="http://registration.com/">Register</a>`
 * Then I added this code at line 292 to wp-bootstrap-carousel.php:
 * `$carousel .= ( ! empty( $item->post_content ) ) ? wpautop( wptexturize( $item-
   >post_content ) ) : '';`
 * [https://wordpress.org/plugins/wp-bootstrap-carousel/](https://wordpress.org/plugins/wp-bootstrap-carousel/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Peter J. Herrel](https://wordpress.org/support/users/donutz/)
 * (@donutz)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/caption-with-additional-button/#post-6011209)
 * [@gerital](https://wordpress.org/support/users/gerital/), thanks for sharing.
   Instead of hacking the plugin, however, I’d recommend using the `wp_bootstrap_carousel_caption_text`
   filter.
 * If you only need one single button globally, you could do something like:
 *     ```
       add_filter( 'wp_bootstrap_carousel_caption_text', 'my_wp_bootstrap_carousel_caption_text', 10, 1 );
       function my_wp_bootstrap_carousel_caption_text( $caption )
       {
           return $caption . '<p><a class="register-button" href="http://example.com/">Register</a></p>';
       }
       ```
   
 * For more fine-grained control, I’d suggest enabling custom fields for the `attachment`
   post type:
 *     ```
       add_post_type_support( 'attachment', 'custom-fields' );
       ```
   
 * And if not empty, appending the value of the field to the caption as follows:
 *     ```
       add_filter( 'wp_bootstrap_carousel_caption_text', 'my_wp_bootstrap_carousel_caption_text', 10, 2 );
       function my_wp_bootstrap_carousel_caption_text( $caption, $item_id )
       {
           $post_meta = get_post_meta( $item_id, 'wpbc_btn', true );
   
           if( '' != $post_meta )
               $caption .= "<p>{$post_meta}</p>";
   
           return $caption;
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Caption with additional button’ is closed to new replies.

 * ![](https://ps.w.org/wp-bootstrap-carousel/assets/icon-256x256.png?rev=1006166)
 * [WP Bootstrap Carousel](https://wordpress.org/plugins/wp-bootstrap-carousel/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-bootstrap-carousel/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-bootstrap-carousel/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-bootstrap-carousel/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-bootstrap-carousel/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-bootstrap-carousel/reviews/)

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [Peter J. Herrel](https://wordpress.org/support/users/donutz/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/caption-with-additional-button/#post-6011209)
 * Status: resolved