Skip to content

Instantly share code, notes, and snippets.

Created January 20, 2012 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/55b934a1264580814ac1 to your computer and use it in GitHub Desktop.
Save anonymous/55b934a1264580814ac1 to your computer and use it in GitHub Desktop.
Slideshow - nivo slider to anything slider
<?php
query_posts( array(
'ignore_sticky_posts' => 1,
'meta_key' => '_ttrust_in_home_slideshow_value',
'meta_value' => 'true',
'posts_per_page' => 20,
'post_type' => array(
'page',
'projects',
'posts'
)
));
?>
<?php if(have_posts()) :?>
<div id="slideshow" class="clearfix">
<div id="slider" class="clearfix">
<?php $captions = array(); ?>
<?php $i = 1; while (have_posts()) : the_post(); ?>
<?php $style = ""; ?>
<?php if($i > 1) $style = "display: none;"; ?>
<?php $deactivate_links = ttrust_get_option('ttrust_slide_deactivate_links'); ?>
<?php $slideLink = get_permalink(); ?>
<?php $slide_img = get_post_meta($post->ID, "_ttrust_home_slideshow_img_value", true); ?>
<?php $captions[] = '<h3>'.get_post_meta($post->ID, "_ttrust_home_slideshow_title_value", true).'</h3><p>'.get_post_meta($post->ID, "_ttrust_home_slideshow_caption_value", true).'</p>'; ?>
<?php if($deactivate_links) : ?>
<img src="<?php echo $slide_img; ?>" alt="<?php the_title(); ?>" title="#caption<?php echo count($captions)-1;?>" />
<?php else :?>
<a href="<?php the_permalink() ?>" rel="bookmark" ><img src="<?php echo $slide_img; ?>" alt="<?php the_title(); ?>" title="#caption<?php echo count($captions)-1;?>" /></a>
<?php endif; ?>
<?php $i++; endwhile; ?>
<?php wp_reset_query();?>
</div><!-- /slider -->
<?php
foreach($captions as $key => $caption) :
?>
<div id="caption<?php echo $key; ?>" class="nivo-html-caption">
<?php echo $caption; ?>
</div>
<?php
endforeach;
?>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment