• On the theme I am using – Moov – there is a slider that displays recent posts with thumbnails. An example can be found here (you’ll need to scroll down a bit).

    I was hoping to change the slider to only show posts from a specific category, but I’m not sure how to go about it. I was hoping that someone could take a moment to help me out.

    The code for the slider follows:

    <?php
    	$my_query = new WP_Query('posts_per_page=50');
    		while ($my_query->have_posts()) : $my_query->the_post();
    			?>
    				<li>
    					<a class="image" href="<?php the_permalink(); ?>" title="<?php printf( __('%s', 'moov'), the_title_attribute('echo=0') ); ?>" rel="bookmark">
    					<?php if(has_post_thumbnail()) {
    										echo get_the_post_thumbnail( $post->ID, 'other-post-thumbnail', array('alt'=>the_title_attribute('echo=0'),'title'=>the_title_attribute('echo=0')) );
    					} else {
    					echo '<img src="'.get_bloginfo("template_url").'/images/thumbnail_other.png" />';
    					} ?>
    					<span></span>
    				</a>
    			</li>
    	<?php endwhile; ?>

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change 'Recent Posts'-slider to get posts from specific category’ is closed to new replies.