title: Wordpress featured image code
body: <p>Hi I'm trying to figure out how to put a featured image in wordpress on my custom page.</p>
  
  <p>here is my code: </p>
  
  <pre><code>            &lt;?php
  
                      $args = array( 'numberposts' =&gt; '1' );
                      $recent_posts = wp_get_recent_posts( $args );
                      if (has_post_thumbnail() ) {
                      foreach( $recent_posts as $recent ){
                          the_post_thumbnail();
                          echo '&lt;li&gt;&lt;a href="' . get_permalink($recent["ID"]) . '"&gt;' .   $recent["post_title"].'&lt;/a&gt; &lt;/li&gt; ';
                      }
                  }
                  else {
                      echo "no featured post";
                  }
              ?&gt;
  </code></pre>