• Hi guys, i have created a shortcode for the Twitter Bootstrap carousel, with the following as part of it:

    function j72_carousel_img($atts, $content = null) {
                return '<div class="item">' . do_shortcode( $content ) . '</div>';
      }

    What i need is for the above to be looped through so that the first instance of this line has the class “active” added to it like this:

    <div class="item active">

    This indicates the first image in the carousel – can anyone let me know what needs to be done to achieve this?

    Thanks

  • The topic ‘Shortcode creation – need loop or if statement?’ is closed to new replies.