Skip to content

Instantly share code, notes, and snippets.

@jasperf
Last active October 7, 2015 05:07
Show Gist options
  • Save jasperf/3109949 to your computer and use it in GitHub Desktop.
Save jasperf/3109949 to your computer and use it in GitHub Desktop.
Nivo Slider in WordPress met WP_Query #wordpress #slider #wp-query
<div id="slider-wrapper">
<div class="slider-wrapper theme-default">
<div class="ribbon"></div>
<div id="slider" class="nivoSlider">
<?php $pj_slider = new WP_Query('post_type=img_slideshow&showposts=4'); while($pj_slider->have_posts()) : $pj_slider->the_post(); ?>
<?php $pj_slider_caption = '#slider-caption-'.get_the_ID(); ?>
<?php if(has_post_thumbnail() ) { ?>
<?php the_post_thumbnail('slider', array('title' => ''.$pj_slider_caption.'')); ?>
<?php } ?>
<?php endwhile; wp_reset_query(); ?>
</div>
<?php $pj_slider_caption = new WP_Query('post_type=img_slideshow&showposts=4');
while($pj_slider_caption->have_posts()) : $pj_slider_caption->the_post(); ?>
<div id="slider-caption-<?php the_ID(); ?>" class="nivo-html-caption">
<span class="nivo-caption-title"><?php the_title(); ?></span>
<?php $pj_nivo_caption_content = get_the_excerpt(); ?>
<span class="nivo-caption-content"><?php echo $pj_nivo_caption_content; ?></span>
<span class="nivo-caption-link"><a href="<?php the_permalink(); ?>">Read more about this feature &raquo;</a></span>
</div><!-- // nivo-html-caption -->
<?php endwhile; wp_reset_query(); ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment