How to show only 6 posts in wordpress

I tried to do 3 column post in my wordpress using this coding in other forum.


<table cellpadding="10" cellspacing="10" border="0">
<?php
$col = 0;
$cols_per_row = 2;

while (have_posts()) : the_post();
  if($col == 0) echo '<tr>';
  ?>
  <td class="column'<?php echo $col; ?>" style="vertical-align: top">

  <div class="post" id="post-'<?php the_ID(); ?>'">
	<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>

<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('thumbnail');?></a>


	<div class="entry">
<?php the_excerpt() ?>
	</div>
  </div>
  <td>
  <?php
  if($col++ >= $cols_per_row){
	$col = 0;
	echo '</tr>';
  }
endwhile;
?>
</table>

It works. but problem is, it always display the latest 10 items.

how do I limit it to a single category X and also 6 items max?

I tried to add in the codex from wordpress site
like this


  <?php $my_query = new WP_Query('category_name=featured&posts_per_page=1');


but it gave a syntax error. Hope someone can help me.
thanks.

This is in the wordpress settings section, go to /wp-admin/, click settings, click reading, type in a number under “Blog Pages Show At Most”, click save changes.

Attached an image for your reference from my own blog’s settings <snip/>

Regards,
Chris

/smack myself in the head.

SILLY ME !

thanks!

wasn;t able to edit my thread.

one thing, how do i show just a particular category?

I usually upload a new file to my theme directory, which is a template. Then I make a new “page” based off the template, so I can php. Then use http://codex.wordpress.org/Function_Reference/wp_get_archives

thanks for the reply. i manage to sort it out.
it was easier than i thought.



<table cellpadding="10" cellspacing="10" border="0">
<?php
$col = 0;
$cols_per_row = 2;

query_posts('cat=31');

while (have_posts()) : the_post();
  if($col == 0) echo '<tr>';
  ?>
  <td class="column'<?php echo $col; ?>" style="vertical-align: top">

  <div class="post" id="post-'<?php the_ID(); ?>'">
	<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>

<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('thumbnail');?></a>


	<div class="entry">
<?php the_excerpt() ?>
	</div>
  </div>
  <td>
  <?php
  if($col++ >= $cols_per_row){
	$col = 0;
	echo '</tr>';
  }
endwhile;
?>
</table>

all it needed was to add

query_posts('cat=31');

cat for category.

thanks for the reply anyway. :smiley: appreciate it.