title: Change page template to show Custom Post Type in Wordpress
body: <p>I have this Page Template, developed by someone else a long long time ago, which shows all my Posts in a grid based on the category they're in.</p>
  
  <p>Now, I want to have such a page for my Custom Post Type but I can't get it to work. I tried replacing the </p>
  
  <pre><code>&lt;?php if (have_posts()) : while (have_posts()) : the_post();?&gt;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>&lt;?php $args = array('post_type'=&gt;array('shopitems')); query_posts($args); if ( 
  have_posts() ) : while ( have_posts() ) : the_post();?&gt;`
  </code></pre>
  
  <p>which seems to be the go-to answer everywhere I look. but for me, it turns out empty. 
  Below the original Page Template, I want to change this so it loads the 'shopitems' Custom Post Type.</p>
  
  <p>Any help or nod in the right direction is greatly appreciated!</p>
  
  <pre><code>&lt;?php get_header(); ?&gt;
  &lt;div class="content-sidebar-wrap"&gt;
      &lt;?php if (have_posts()) : while (have_posts()) : the_post();?&gt;
    &lt;?php $category_list= get_the_content(); ?&gt;
  &lt;?php endwhile; endif; ?&gt;
      &lt;div id="content" class="post-category page"&gt;
      &lt;?php $category_name=explode(',', $category_list);
       $catIDs="";
          foreach ($category_name as $cat_name) {
              $catIDs.= get_cat_ID(trim($cat_name)).",";
            } 
            $catIDs=trim($catIDs,","); 
            $i=0;
      ?&gt;  
          &lt;?php $thePosts= query_posts('cat='.$catIDs.'&amp;post_status=publish&amp;posts_per_page=-1'); ?&gt;
          &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;
       &lt;?php if (has_post_thumbnail( $post-&gt;ID ) ) { ?&gt;
          &lt;?php // $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post-&gt;ID ), 'single-post-thumbnail' ); ?&gt;
          &lt;?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post-&gt;ID ) ); ?&gt;
         &lt;?php if($i%4==0) { ?&gt;
         &lt;div class="clear"&gt;&lt;/div&gt;
         &lt;?php } $i++; ?&gt;
        &lt;div class="thumb"&gt;
          &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;
           &lt;img alt="" src="&lt;?php echo $image[0]; ?&gt;" class="thumb-img"&gt; 
           &lt;span class="thumb-title"&gt;
              &lt;?php 
              $second_name = get_field('second_name');
              if( $second_name &amp;&amp; !empty($second_name))
                  echo $second_name;
              else
              the_title(); 
              ?&gt;
           &lt;/span&gt; 
          &lt;/a&gt;
        &lt;/div&gt;
          &lt;?php } endwhile; else: endif; ?&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;?php get_footer(); ?&gt;
  </code></pre>