Echo within an Array [duplicate]

0

I have the following situation:

<?php 
    $args = array('post_type'=>'post', 'showposts'=>-1);
    $my_posts = get_posts( $args );
    $count = 0 ;
    if($my_posts) : foreach ($my_posts as $post) : setup_postdata( $post );
     ?>

    <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3 pad-b">   
        <!-- modal -->

        <?php the_post_thumbnail(false, array('type'=>'button', 'class'=>'img-responsive', 'data-toggle'=>'modal', 'data-target'=>'#myModal<?php echo $count; ?>')); ?>

        <div class="modal fade bs-example-modal-lg" id="myModal<?php echo $count; ?>" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                      <?php the_post_thumbnail('full'); ?>
                </div>
          </div>
        </div>
        <!-- fim modal -->
    </div>

    <?php
        $count ++ ;
        endforeach;
        endif;
     ?>

I need the $ count to be printed inside the_post_thumbnail's data-target array.

<?php the_post_thumbnail(false, array('type'=>'button', 'class'=>'img-responsive', 'data-toggle'=>'modal', 'data-target'=>'#myModal<?php echo $count; ?>')); ?>

What is the best way to do this?

    
asked by anonymous 12.12.2017 / 06:03

0 answers