title: Trying to display all posts in my archive page but it is only returning the page content
body: <p>I'm having a problem with displaying all posts in my archive page using the have_posts loop. When I try to return the title and the content, it returns the template page's title and content instead of the posts' content.</p>
  
  <p>What I did to try and fix it is I ran a WP_Query post loop which grabs all the posts of post type = post and it displays the content just fine. The only problem is I want a dynamic archive page so when users select a tag - it will take them to an archive page with all the posts containing that tag. Since I am running a specific WP_Query, all my archive pages display all the posts with the post-type = post. </p>
  
  <p>My guess is that I have to run a simple have_posts loop instead of running WP_Query in order for my archive page to dynamic.</p>
  
  <p>How I set up my archive page: I have a file called archive.php which I gave the template name of Archives and created a page for it on wp-admin and titled it Blog.</p>
  
  <pre><code>&lt;?php
  /**
   * The template for displaying archive pages
   * Template Name: Archives
   * @link https://codex.wordpress.org/Template_Hierarchy
   *
   * @package WordPress
   * @subpackage Twenty_Seventeen
   * @since 1.0
   * @version 1.0
   */
  
  get_header(); ?&gt;
  
    &lt;div class="d-flex flex-wrap archive-wrap"&gt;
  
     &lt;div class="content-area"&gt;
      &lt;main id="main" class="site-main d-flex justify-content-center flex-wrap" role="main"&gt;
  
      &lt;?php // Show the selected frontpage content.
      if ( have_posts() ) :
          while ( have_posts() ) : the_post(); ?&gt;
  
          &lt;div class="archive-header col-10 d-flex justify-content-center align-items-center flex-column"&gt;
              &lt;?php
                  the_title( '&lt;h1 class="archive-title"&gt;', '&lt;/h1&gt;' );
                  the_content( '&lt;h1 class="archive-title"&gt;', '&lt;/h1&gt;'); 
              ?&gt;
  
          &lt;/div&gt;&lt;!-- .page-header --&gt;
  
      &lt;?php
  
          get_template_part( 'template-parts/post/content', 'archive' );
  
          endwhile;
  
          the_posts_pagination( array(
              'prev_text' =&gt; twentyseventeen_get_svg( array( 'icon' =&gt; 'arrow-left' ) ) . '&lt;span class="screen-reader-text"&gt;' . __( 'Previous page', 'twentyseventeen' ) . '&lt;/span&gt;',
              'next_text' =&gt; '&lt;span class="screen-reader-text"&gt;' . __( 'Next page', 'twentyseventeen' ) . '&lt;/span&gt;' . twentyseventeen_get_svg( array( 'icon' =&gt; 'arrow-right' ) ),
              'before_page_number' =&gt; '&lt;span class="meta-nav screen-reader-text"&gt;' . __( 'Page', 'twentyseventeen' ) . ' &lt;/span&gt;',
          ) );
  
      endif; ?&gt;
  
      &lt;div class="col-10 col-md-3 offset-lg-1 sidebar-4-container"&gt;
          &lt;?php dynamic_sidebar( 'sidebar-4' ); ?&gt;
      &lt;/div&gt;
  
  
      &lt;/main&gt;&lt;!-- #main --&gt;
  &lt;/div&gt;&lt;!-- #primary --&gt;
  
  &lt;/div&gt;&lt;!-- .wrap --&gt;
  
  &lt;?php get_footer();
  </code></pre>
  
  <p>Inside my template content archive file I have the following:</p>
  
  <pre><code>&lt;?php 
   // the query
   $wpb_all_query = new WP_Query(array('post_type'=&gt;'post', 
   'post_status'=&gt;'publish', 'posts_per_page'=&gt;-1)); ?&gt;
  
  &lt;?php if ( $wpb_all_query-&gt;have_posts() ) : ?&gt;
  
  
      &lt;!-- the loop --&gt;
      &lt;?php while ( $wpb_all_query-&gt;have_posts() ) : $wpb_all_query-&gt;the_post(); ?&gt;
      &lt;div id="post-&lt;?php the_ID(); ?&gt;" class="col-12 article-container"&gt;
          &lt;div class="article-image-div" style="background-image: url('&lt;?php echo get_the_post_thumbnail_url( $post_id, 'large' );  ?&gt; ');"&gt;&lt;/div&gt;
          &lt;h3&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h3&gt;      
          &lt;h5&gt;by &lt;?php echo get_the_author(); ?&gt;&lt;/h5&gt;
          &lt;?php echo apply_filters( 'the_content', wp_trim_words( strip_tags( $post-&gt;post_content ), 55 ) ); ?&gt;
  
          &lt;hr align="left"&gt;   
      &lt;/div&gt;
  
  
      &lt;?php endwhile; ?&gt;
      &lt;!-- end of the loop --&gt;
  
  
      &lt;?php wp_reset_postdata(); ?&gt;
  
  &lt;?php else : ?&gt;
      &lt;p&gt;&lt;?php _e( 'Sorry, no posts matched your criteria.' ); ?&gt;&lt;/p&gt;
  &lt;?php endif; ?&gt;
  </code></pre>