WordPress.org

Ready to get started?Download WordPress

Forums

Repeating Results w/ Category Filtering (1 post)

  1. r3p0d3p0t
    Member
    Posted 3 years ago #

    I’m using this to display featured images in a js “image slider”. Since either 3.1 or (more likely) my own user-error, it results in only the 2nd-oldest post’s featured image displayed for each of 5 instance of $slide. Meanwhile, the_content() displays all 5 posts' text just fine.

    See it in action

    //Displays featured images of posts with 'masthead_slider' category
    
    			$slider_args = array(
    				'category_name' => 'masthead_sliders',
    				'numberposts' => -1,
    				);
    			$slider = get_posts($slider_args);
    			foreach ($slider as $slide) : setup_postdata($slide); ?>
    				<div><?php the_post_thumbnail($post->ID); the_content();?>
    				</div>
    			<?php endforeach; ?>

    Thanks for any help on this!

Topic Closed

This topic has been closed to new replies.

About this Topic