How to display a specific category of posts
-
Hi all,
I am attempting to build a website for the first time – it is almost there but I need a helping hand on a few small issues please.
I am trying to get the following to JUST display the latest REPORTS – not all the latest posts.
Thanks in advance,
Andy
<div class="container" id="recent-posts"> <div class="four columns leftbox"> <h2>reports</h2> <p>These are the latest reports</p> </div> <?php $query = new WP_Query( array( 'posts_per_page' =>'3' ) ); if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?> <div class="four columns rightbox"> <?php $image_attr = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'index_wide'); ?> <a href="<?php the_permalink() ?>"> <img src="<?php echo $image_attr[0]; ?>" class="index-wideimg scale-with-grid"></a> <div class="panelpost"> <h2><a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a></h2> <span class="paneldate"><?php the_time('l, n F Y'); ?></span> </div> </div> <?php endwhile; endif; ?> </div>
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘How to display a specific category of posts’ is closed to new replies.