Reputation:
I have a post loop (index.php) which shows three post links as headers and above them there's a slideshow based on the slug of the post.
<div class="nuotraukos">
<?php if (have_posts()) : ?>
<?php $nuotraukos = new WP_Query('category_name=nuotraukos&showposts=3');
while ($nuotraukos->have_posts()) : $nuotraukos->the_post();
$do_not_duplicate = $post->ID; ?>
<div class="post" id="post-<?php the_ID(); ?>">
<p class="postmetadata"><?php edit_post_link(__('Edit')); ?></p>
<div class="entry">
<?php
if ( function_exists( 'meteor_slideshow' ) ) {
$slug = basename(get_permalink());
meteor_slideshow('' . $slug. '');
}
the_content('<h2>' . get_the_title() . '</h2>');
?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
Meteor slideshow has a loop itself and I assume that it cancels the post loop after the first query. That's why it prints out only one title (but displays it three times) you can see it in http://studioglamour.co.uk.
The thing is i need three different links displayed below slideshows, but don't know how to fix this.
Upvotes: 4
Views: 155
Reputation: 5683
Try
$slug = basename(get_permalink($nuotraukos->post->ID));
...
the_content('<h2>' . get_the_title($nuotraukos->post->ID) . '</h2>');
Upvotes: 1