title: Iterate through custom post type by custom taxonomy type? (Ordering wordpress posts by category, or displaying custom post type by taxonomy term)
body: <p>I want to have a page that shows all posts, separated by category. The idea is to get the categories, and then iterate through all posts for each category. The problem is complicated by the fact that I want to iterate through all posts of a given custom type, using a custom taxonomy as the categories. (Running Wordpress 3)</p>
  
  <p>In my functions.php, my custom post type is registered as "video" and the custom taxonomy as "video_types".</p>
  
  <p>In my custom page template that is supposed to show all videos arranged by category, this is the code that isn't returning any posts (and they're there, I checked):</p>
  
  <pre><code>&lt;?php 
    $categories = get_categories(array(
      'taxonomy' =&gt; 'video_types'
    )); 
    foreach ($categories as $cat):
  ?&gt;
   &lt;section id="&lt;?php $cat-&gt;slug ?&gt;" class="video-category"&gt;
       &lt;?php
    query_posts(array(
        'cat' =&gt; $cat-&gt;cat_ID,
        'posts_per_page' =&gt; -1
           ));
       ?&gt;
       &lt;h2&gt;&lt;?php single_cat_title(); ?&gt;&lt;/h2&gt;
      &lt;p class="description"&gt;&lt;?php echo category_description($cat-&gt;cat_ID); ?&gt;&lt;/p&gt;
    &lt;?php while (have_posts()) : the_post(); ?&gt;
        &lt;?php
         $category = get_the_category(); 
              echo $category[0]-&gt;cat_name;
        ?&gt;
        &lt;div id="post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class(); ?&gt;&gt;
        &lt;article class="video"&gt;
          &lt;h3&gt;&lt;?php the_title(); ?&gt;&lt;/h3&gt;
          &lt;p&gt;
            &lt;?php the_content() ?&gt;
          &lt;/p&gt;
        &lt;/article&gt;
    &lt;?php endwhile; ?&gt;
   &lt;/section&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>