WordPress.org

Ready to get started?Download WordPress

Forums

bootstrap carousel in wordpress video post format not show carousel in old posts (1 post)

  1. rerraw
    Member
    Posted 3 months ago #

    hi i crate this code within bootstrap carousel the code it is work correctly in one post only when i add video or gallery post the carousel it is work correctly but when i add another video or gallery post my carousel not work in old post only work in the first recent post

    i think the active class not work in more than one posts when i add class active by jquery to my first carousel item (as shown in my code) only active class work in one post (first recent post) and not work in old posts

    please why directly after opening my home page the active class don't add to all carousel item s in all posts please help me

    my code

    `<script>
    $(document).ready(function() {
    $(".posts-video .carousel-inner .item:first").addClass("active");
    });
    </script>

    <?php
    global $post;
    $array_meta = get_post_meta($post->ID);
    $video_meta = array_slice($array_meta, 3);
    ?>

    <div class="posts-video carousel slide" data-ride="carousel">

    <!-- Carousel items -->
    <div class="carousel-inner">

    <?php foreach ($video_meta as $video_metas) : ?>

    <?php if ( is_numeric($video_metas) ) { } ?>
    <?php if ( is_int($video_metas) ) { } ?>

    <figure class="item">
    <?php echo $video_metas[0]; ?>
    </figure>

    <?php endforeach; ?>

    </div>

    <!-- Controls -->

    <span class="glyphicon glyphicon-chevron-left"></span>


    <span class="glyphicon glyphicon-chevron-right"></span>

    </div>

Reply

You must log in to post.

About this Topic