title: Wordpress search results multiple loops by category
body: <p>I found a piece of code that allows me to have two separate loops so I can display search results in two different categories, which is great because they are also styled different.</p>
  
  <p>I would like help amending this code below to include showing a 'no results found' message for each loop and add pagination for the second 'blog' category only, the top one 'shop' should show a max of 6 results.</p>
  
  <pre><code>&lt;?php
  get_header(); ?&gt;
  &lt;div class="content"&gt;
          &lt;?php
              $s = get_search_query();
          ?&gt;
  &lt;div class="search"&gt;
      &lt;div class="categoryThumbs"&gt;
      &lt;?php if (have_posts()) : ?&gt;
          &lt;h3&gt;&lt;?php printf( __( 'Search Results for: %s'), '&lt;span&gt;' . get_search_query() . '&lt;/span&gt;' ); ?&gt;&lt;/h3&gt;
      &lt;?php endif;?&gt;
          &lt;?php query_posts("s='$s'&amp;category_name=shop"); ?&gt;
              &lt;?php if (have_posts()) : ?&gt;
                  &lt;?php $blogResults=0; ?&gt;
              &lt;?php while (have_posts()) : the_post(); ?&gt;
                  &lt;?php
                      $blogResults++;
                  ?&gt;
              &lt;?php endwhile; ?&gt;
                  &lt;h4&gt;&lt;?php echo $blogResults; ?&gt; Results in Shop&lt;/h4&gt;
                  &lt;?php while (have_posts()) : the_post(); ?&gt;
                  &lt;div class="films"&gt;
                      &lt;div class="thumb"&gt;
                          &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_post_thumbnail(); ?&gt;&lt;/a&gt;
                      &lt;/div&gt;
                      &lt;h3 id="post-&lt;?php the_ID(); ?&gt;"&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title_attribute(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h3&gt;
                      &lt;div class="entry"&gt;
                          &lt;?php the_excerpt() ?&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;?php endwhile; ?&gt;
              &lt;?php endif;?&gt;
              &lt;?php query_posts("s='$s'&amp;category_name=blog"); ?&gt;
              &lt;?php if (have_posts()) : ?&gt;
                  &lt;?php $blogResults=0; ?&gt;
              &lt;?php while (have_posts()) : the_post(); ?&gt;
                  &lt;?php
                      $blogResults++;
                  ?&gt;
              &lt;?php endwhile; ?&gt;
                  &lt;h4&gt;&lt;?php echo $blogResults; ?&gt; Results in Blog&lt;/h4&gt;
                  &lt;?php while (have_posts()) : the_post(); ?&gt;
                  &lt;div class="films"&gt;
                      &lt;div class="thumb"&gt;
                          &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_post_thumbnail(); ?&gt;&lt;/a&gt;
                      &lt;/div&gt;
                      &lt;h3 id="post-&lt;?php the_ID(); ?&gt;"&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title_attribute(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h3&gt;
                      &lt;div class="entry"&gt;
                          &lt;?php the_excerpt() ?&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;?php endwhile; ?&gt;
              &lt;?php endif;?&gt;
      &lt;div class="spacer"&gt;&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
   
  
  <p>Thanks for any help!</p>