title: Wordpress: Custom order query (categories)
body: <p>I am using the latest version of WP, no plugins installed but one (I am talking about it later). For every category I have assigned a featured image and I would like to make a page where every category is shown with its featured image. I have installed the Category Order and Taxonomy Order plugin in order to change the order of appearence of the categories. For example we have the categories 1,2,3,4 and the desired order is 3,1,2,4. </p>
  
  <p>In the functions.php I have put</p>
  
  <pre><code>function wptp_add_categories_to_attachments() {
      register_taxonomy_for_object_type( 'category', 'attachment' );
  }
  add_action( 'init' , 'wptp_add_categories_to_attachments' );
  </code></pre>
  
  <p>in order to have featured images for the categories.</p>
  
  <p>In my page's template I put</p>
  
  <pre><code> $cats = get_categories();
      for_each ($cats as $category)
      {
      if ($category-&gt;term_id != 1){
         $terms[] = $category-&gt;term_id}
  }
  
  $args = array(
                          'post_type' =&gt; 'attachment',
                          'post_status'=&gt;'inherit',
                          'category__in' =&gt; $terms,
                        /*'order_by' =&gt; 'none' */
                      );
  $query = new WP_Query( $args );
  .......
  </code></pre>
  
  <p>The rest is code where I have the output of the "posts". The problem is that <strong><em>$terms</em></strong> contains the right order (3,1,2,4), <strong><em>$query</em></strong> does not (4,3,2,1). Even if I put manually the numbers in <em>'cat'</em> (in $args), the output order is always the same.
  I even created a string from <strong><em>$terms</em></strong> and used it with <em>'cat'</em> but the result is the same.</p>
  
  <p>Is there a way to make a query and the results are in the order I want (not ASC, DESC, or alphabetical, or time-dependent)?</p>