Home

Peter J. Herrel edited this page May 7, 2015 · 26 revisions
Clone this wiki locally

WP Bootstrap Carousel is a simple, straightforward implementation of the Twitter Bootstrap Carousel in WordPress. This plugin allows you to display images attached to a post or page as a Bootstrap Carousel using the [carousel] shortcode. As a bonus, this plugin can transform post listings generated by the Display Posts Shortcode plugin into a Bootstrap Carousel slideshow.

Download: https://wordpress.org/plugins/wp-bootstrap-carousel/

Shortcode

Display post or page attachments as a Bootstrap Carousel with following shortcode:

In the post editor:

[carousel]

In a PHP file:

echo do_shortcode('[carousel]');

Shortcode Parameters

The shortcode takes following parameters:

Query Variables

  • post_parent: (integer) The ID of the post parent. Modify this to display a slideshow of attachments of a post in another post, or in a template file like index.php. Default: the ID of the current post.
  • post_status: (string) The post status of the image attachments. Default: 'inherit'.
  • post_type: (string) The post type of the image attachments. Default: 'attachment'.
  • post_mime_type: (string) The mime type of the image attachments. Default: 'image'.
  • exclude: (string) Comma separated list of numeric attachment IDs to exclude. Default: the ID of the current post's thumbnail.
  • order: (string) The order of the attachments. Default: 'ASC'.
  • orderby: (string) How to order the attachments. Default: 'ID'.

Javascript Variables

  • interval: (integer) The amount of time to delay between automatically cycling an item. If 0 (zero), carousel will not automatically cycle. Default: 5000.
  • pause: (string) Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. Default: 'hover'
  • wrap: (bool) Whether the carousel should cycle continuously or have hard stops. Default: 1
  • keyboard: (bool) Whether the carousel should react to keyboard events. Default: 1
  • thickbox: (bool) Whether to open images in a thickbox when clicked. Default: 1
  • unwrap: (bool) Whether to hyperlink the images in the carousel. Default: 0

Display Variables

  • width: (integer) Used to set the max-width of the container and the images. Default: 100%.
  • image_size: (string) The thumbnail size of the images in the carousel. Default: 'large'.
  • rel: (string) The rel attribute of attachment links. Default: empty.
  • file: (bool) Whether to link to the actual attachment file, or to the attachment page. Default: 1.
  • comments: (bool) Whether to show comments link (if comments are open). Default: 0.
  • slide: (bool) Whether to use CSS3 transitions. Default: 1
  • controls: (bool) Whether to display the carousel controls. Default: 1

Action hooks

  • wp_bootstrap_carousel_loaded
  • wp_bootstrap_carousel_init
  • wp_bootstrap_carousel_enqueue

Filter hooks

  • wp_bootstrap_carousel_no_results
  • wp_bootstrap_carousel_feed
  • wp_bootstrap_carousel_caption_text
  • wp_bootstrap_carousel_shortcode_atts

Example

[carousel exclude="12,15,19" interval="2000"]

Displaying Posts

WP Bootstrap Carousel is able to transform post listings generated by Bill Erickson's Display Posts Shortcode plugin (version 2.2.1 or higher) into a Bootstrap Carousel slideshow. Simply add a bootstrap parameter to the shortcode, e.g.:

[display-posts tag="advanced" posts_per_page="10" include_excerpt="true" image_size="large" bootstrap="1"]

Displaying Image Attachments

Using the DPS addon to display sets of unrelated image attachments, e.g.:

[display-posts post_type="attachment" id="4,7,10" bootstrap="1"]

Display Posts Shortcode parameters

https://github.com/billerickson/display-posts-shortcode/wiki

Additional Parameters

  • bootstrap: (bool) Whether to display the posts listing as a Bootstrap Carousel slideshow. Default: 0
  • interval: (integer) Rotation speed of the images in the slideshow. Default: 5000.
  • pause: (string) Default: 'hover'
  • wrap: (bool) Whether the carousel should cycle continuously or have hard stops. Default: 1
  • keyboard: (bool) Whether the carousel should react to keyboard events. Default: 1
  • thickbox: (bool) Whether to open images in a thickbox when clicked. Default: 0
  • unwrap: (bool) Whether to hyperlink the images in the carousel. Default: 0

Filter hooks

  • wp_bootstrap_carousel_dps_feed
  • wp_bootstrap_carousel_dps_the_excerpt
  • wp_bootstrap_carousel_dps_the_content
  • wp_bootstrap_carousel_dps_caption
  • wp_bootstrap_carousel_dps_title

Tips & Tricks

Support