Show wordpress posts from one category only

admin

Administrator
Staff member
I am trying to display posts of a certain category to a page showing a thumbnail then linking through to the full posts. This is going to be fore a case study section.

I have the links showing up and carrying me through however it displays ALL posts instead of the specific category like I want.

Any ideas? I'm not familiar with PHP and only just stated using wordpress

my code:

Code:
<?php // PAGE LINK/TITLE

if (is_page()) {
  $cat=get_cat_ID($post->post_title); //use page title to get a category ID
  $posts = get_posts ("cat=$cat&showposts=10");
  if ($posts) {
    foreach ($posts as $post):
      setup_postdata($post); 

 if ( has_post_thumbnail() ) { // PULLS IN IMAGE check if the post has a Post Thumbnail assigned to it.
    the_post_thumbnail();
} 

?>

<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<?php //PULLS IN EXCERPT
$my_excerpt = get_the_excerpt();
if ( '' != $my_excerpt ) {
    // Some string manipulation performed
}
echo $my_excerpt; // Outputs the processed value to the page

?>

<?php endforeach;
  }
}
?>