title: Wordpress posts loop show post_name / slug
body: <p>I am running this PHP code to loop through wordpress posts:</p>
  
  <pre><code>$posts = get_posts('numberposts=10&amp;order=ASC&amp;orderby=post_title');
  foreach ($posts as $post)
  {
      setup_postdata( $post );
      the_date();
      echo '&lt;br /&gt;'; ?&gt;
      &lt;a href="/blog2/"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;    
      &lt;?php the_excerpt(); ?&gt;
      &lt;br&gt;&lt;hr /&gt;&lt;br&gt;
      &lt;?php
  }
  </code></pre>
  
  <p>I want to be able to show the post_name or 'slug' of each post</p>
  
  <p>I have tried using <code>echo $posts-&gt;post_name;</code> but it doesn't display anything</p>