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 $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’s the best way to do that?
'data-target'=>"#myModal{$count}"
?– NoobSaibot
Thank you. I had tenado the ($Count), but I didn’t notice the difference from " to ' '. Hugs
– Guicafe