Outputs only the first image
-
I am having an issue with the plugin. I can only seem to get it to output the first image of the attachments, although it is registering the total amount of attachments (as seen in the number of thumbnails it shows). Can’t figure out what I’m doing wrong.
<?php $args = array( 'post_status' => 'null', 'post_type' => 'gallery', 'order' => 'ASC', 'showposts' => -1 ); $my_query = new WP_Query($args); if($my_query->have_posts()) : while($my_query->have_posts()) : $my_query->the_post(); ?> <?php $attachments = new Attachments( 'my_attachments' ); /* pass the instance name */ ?> <?php if( $attachments->exist() ) : ?> <?php while( $attachment = $attachments->get() ) : ?> slides.push({image : '<?php echo $attachments->url( 'original' ); ?>', title : '', thumb : '<?php echo $attachments->url( 'supersized_thumb' ); ?>', url : ''}); <?php endwhile; endif; ?> <?php endwhile; endif; ?>
Do I need to use some kind of foreach statement? Any ideas would be appreciated.
Here is the page: https://vechik.com/fashion/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Outputs only the first image’ is closed to new replies.