title: Archive Page for Custom Post Type
body: <p>I have created a custom post type called news and added certain news. Now i want to display it in archive page. I have added the 'has_archive' => 'true' in the functions file. 
  My archive page code is: </p>
  
  <pre><code>&lt;?php
          $args = array('post_type'   =&gt; 'news',
                        'post_status' =&gt; 'publish');
  
          $news=wp_get_recent_posts($args);
      ?&gt;
          &lt;div class="container  mc_tb_p"&gt;
                  &lt;h1&gt;NEWS/RELEASES&lt;/h1&gt;
                      &lt;?php
                          foreach ($news as $row) 
                              {
                               $id       = $row['ID'];
                               $ntitle   = $row['post_title'];
                               $ncontent = $row['post_content'];
                               $ncontent = strip_tags($ncontent);
                                if (strlen($ncontent) &gt; 100) 
                                    {
                                      $stringCut = substr($ncontent, 0, 200).'... &lt;a href="'.get_permalink($id).'"&gt;Read More&lt;/a&gt;';
                                    }
                                else{
                                      $stringCut = $row['post_content'];
                                    }
                              $ndate     = $row['post_date'];
                              $trim      = new DateTime($ndate);
                              $trimdate      = $trim-&gt;format('d-m-Y');
                              // var_dump($trimdate);
                      ?&gt;
                  &lt;div class="news_releases"&gt;
                      &lt;a href="&lt;?php echo get_permalink($id)?&gt;"&gt;&lt;h3&gt;&lt;?php echo $ntitle?&gt;&lt;/h3&gt;&lt;/a&gt;
                          &lt;h5&gt;&lt;i&gt;Published On:&amp;nbsp;&lt;?php echo $trimdate?&gt;&lt;/i&gt;&lt;/h5&gt;
                              &lt;p&gt;&lt;?php echo $stringCut;?&gt;&lt;/p&gt;
                  &lt;/div&gt;
                          &lt;?php
                          }
                          ?&gt;
  
          &lt;/div&gt;
  </code></pre>
  
  <p>now when i give my url:https//sitename/news ... its bringing up the single page of the 2nd news and nothing else , i have tried everything but nothing seems to work.Please help</p>