title: WP: How to get just one post, from one category and show it
body: <p><strong>Hello guys!</strong>
  Well i have this code, that shows the one post from each category
  but i need to show just ONE post, and need to set the "name" of category
  i'm trying this:</p>
  
  <pre><code>    &lt;?php 
  $cat_args = array(
    'orderby' =&gt; 'name',
    'order' =&gt; 'ASC',
    'child_of' =&gt; 0
  );
  
  $categories =   get_categories($cat_args); 
  
  foreach($categories as $category) { 
      echo '&lt;dl&gt;';
      echo '&lt;dt&gt; &lt;a href="' . get_category_link( $category-&gt;name ) . '" title="' . sprintf( __( "View all posts in %s" ), $category-&gt;name ) . '" ' . '&gt;' . $category-&gt;name.'&lt;/a&gt;&lt;/dt&gt;';
  
       $post_args = array(
        'numberposts' =&gt; 1,
        'category' =&gt; $category-&gt;term_id 
      );
  
      $posts = get_posts($post_args);
  
      foreach($posts as $post) {
      ?&gt;
          &lt;dd&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/dd&gt;
                  &lt;div class="entry"&gt;
                              &lt;?php the_content(); ?&gt;
                          &lt;/div&gt;
      &lt;?php 
      } 
      echo '&lt;dd class="view-all"&gt; &lt;a href="' . get_category_link( $category-&gt;term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category-&gt;name ) . '" ' . '&gt;View all posts in ' . $category-&gt;name.'&lt;/a&gt;&lt;/dd&gt;';
      echo '&lt;/dl&gt;';
  } 
  ?&gt;
  </code></pre>
  
  <p>I then searched the codex and have not found a way to get categories by name, someone can help me??</p>