Display more of 1 post per category

hello all. happy sunday.
this is what i have:

am reworking my site. and want to play w/using masonry. i have create a grid and would like to display the posts w/my image.
this is the code i have

		  <div class="item">
			<div class="item-content">
						<?php 
							$args = array(
								  'category_name' 	=> 'illustrations',
								  'posts_per_page'	  => 1
							  );
							$my_query = new WP_Query( $args );

							if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); 

							the_post_thumbnail('img240x240');
								the_category(); 

							endwhile;
							endif;

							wp_reset_query();
						?>	
			</div>
		  </div>

Which works great. but for only one most post. for more than that it will show the second right below it rather than in a second individual slot.

<div class="item">
			<div class="item-content">
<?php query_posts( array ( 'category_name' => 'illustrations' , 'posts_per_page'	  => 1) ); ?>
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <div class="post" id="post-<?php the_ID(); ?>">
        
          <?php 
                                 if ( has_post_thumbnail()) {
                                     the_post_thumbnail();
                                 }
                                ?>
	  <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>
        </div>
        <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </div>
    </div>
1 Like

thank you will go try it out.
D

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.