WordPress.org

Support

Support » Themes and Templates » [Resolved] Showing thumbnails based on category

[Resolved] Showing thumbnails based on category

  • At the moment, I’m using this code to pull the thumbnail from the post and show it in an unordered list:

    <ul>
    	<?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
    		<li>
    			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    			<?php the_post_thumbnail( array(150,150) ); ?>
    			</a>
    		</li>
    
    	<?php endwhile; ?>
    
    	<?php endif; ?>
    	</ul>

    I want to tweak it so that it’ll pull the thumbnails from posts inside a specific category. I would like it also to be able to drop another loop below to show thumbnails from another category.

    Can anyone help?

Viewing 1 replies (of 1 total)
  • Solved it myself. Here’s the code for anyone who is interested:

    <ul class="thumbnail">
    <?php $wordpress = new WP_Query(); ?>
    <?php $wordpress->query('cat=3'); ?>
    <?php while($wordpress->have_posts()) : $wordpress->the_post(); ?>
    
    		<li>
    			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    			<?php the_post_thumbnail( array(320,240) ); ?>
    			</a>
    		</li>
    
    	<?php endwhile; ?>
    
    	</ul>
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Showing thumbnails based on category’ is closed to new replies.