How to Dynamic bootstrap carousel bullets in wordpress



Hi, Today I will teach you, how to dynamic bootstrap carousel bullets in WordPress website or themes, just you will query your posttype, WordPress default post or your custom post, and you can see below query codes then you can understand, just add extra dynamic counting¬† functions in your query then it’s working.

You can see below code

global $post;
$number = 0;
$args = array( 'posts_per_page' => -1, 'post_type'=> 'posttype', 'orderby' => 'menu_order', 'order' => 'ASC' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<!--Content Area-->
<li data-target="#myCarousel" data-slide-to="<?php echo $number++; ?>"></li>
<!--Content Area-->

<?php endforeach; ?>


Just you can change your code example: posttype, content area etc…


Thanks for read this article.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!