This is an update to my original post How to make Bootstrap Carousel display WordPress Dynamic Content, so I’ll keep it short…
The Original Source Code
Note: Bootstrap developers have added the
.carousel-indicators feature sometime after my original post. Below, you will see my solution for generating the “data-slide-to” values dynamically…
Now with WordPress template PHP for dynamic content
Of course you’re free to pass all sorts of arguments within the
query_posts('/*your_arguments*/');. I’ve left out “posts_per_page” this time, allowing the default to be whatever you have for Dashboard Settings > Reading > Blog pages show at most = “?” posts.
Note: I’ve removed
.active from the
.carousel-indicators li, as well as from the
.carousel-inner .item. We’ll add it back with jQuery…
Add “active” Class to first items
The script must be called after the bootstrap js file, and preferably this is all happening in the footer.