Skip to content

Instantly share code, notes, and snippets.

@scottnix
Created May 7, 2013 23:20
Show Gist options
  • Save scottnix/5536984 to your computer and use it in GitHub Desktop.
Save scottnix/5536984 to your computer and use it in GitHub Desktop.
Cleaned Slider Variation for a forum post.
// reference - http://thematictheme.com/forums/topic/returntrue-nivo-slider-example-using-the-same-pattern-but-with-anythingslider/
function wicked_slider_frontpage() {
if (is_front_page()) { ?>
<ul class="slider theme-default">
<?php
$tmp = $wp_query;
$wp_query = new WP_Query('posts_per_page=5&#038;category_name=featured');
if($wp_query->have_posts()) {
while($wp_query->have_posts()) :
$wp_query->the_post();
$image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'anythingthumb');
?>
<li class="slider-list">
<a href="<?php the_permalink(); ?>">
<img src="<?php echo $image[0]; ?>" class="attachment-anythingthumb wp-post-image" title="<?php the_title_attribute(); ?>" alt="<?php the_title_attribute(); ?>" />
</a>
</li>
<?php
endwhile;
}
$wp_query = $tmp;
?>
</ul>
<?php }
}
add_action('thematic_belowheader', 'wicked_slider_frontpage');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment