title: Order posts by advanced custom field (switcher)
body: <p>I'm creating a website for a realtor. There is a page where the properties are listed with image, title, excerpt and 2 custom fields for location and price. I have already inserted a filter for the size (1-2 rooms, 3-4 rooms, 5-6 rooms, houses) of the property. The customer should also be able to sort the properties by location (ascending or descending) or price (ascending or descending) like on their current website: <a href="http://urbida-immo.ch/verkauf/urbida.php?typ=1" rel="nofollow">http://urbida-immo.ch/verkauf/urbida.php?typ=1</a></p>
  
  <p>Here's my code right now:</p>
  
  <pre><code>&lt;div class="filter"&gt; 
  &lt;input type="radio" id="reset" name="color"/&gt;
  &lt;label for="reset"&gt;Alle&lt;/label&gt;
  &lt;input type="radio" id="kategorie-1-2-zimmer" name="color"/&gt;
  &lt;label for="kategorie-1-2-zimmer"&gt;1 - 2 Zimmer&lt;/label&gt;
  &lt;input type="radio" id="kategorie-3-4-zimmer" name="color"/&gt;
  &lt;label for="kategorie-3-4-zimmer"&gt;3 - 4 Zimmer&lt;/label&gt;
  &lt;input type="radio" id="kategorie-5-6-zimmer" name="color"/&gt;
  &lt;label for="kategorie-5-6-zimmer"&gt;5 - 6 Zimmer&lt;/label&gt;
  &lt;input type="radio" id="kategorie-haeuser" name="color" /&gt;
  &lt;label for="kategorie-haeuser"&gt;Häuser&lt;/label&gt;
  
  &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
  &lt;article id="post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class( 'cf' ); ?&gt; role="article"&gt;
          &lt;div class="col-1of3"&gt;
              &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php
                 if ( has_post_thumbnail() ) {
                     the_post_thumbnail('4zu3');
                 }
              ?&gt;&lt;/a&gt;
          &lt;/div&gt;
          &lt;div class="col-2of3"&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;?php if (get_field( 'adresse' ) ): ?&gt; 
                  &lt;p&gt;&lt;?php the_field('adresse'); ?&gt;&lt;/p&gt;
              &lt;?php endif; ?&gt;                                     
              &lt;p&gt;&lt;?php the_excerpt(); ?&gt;&lt;/p&gt;
              &lt;?php if (get_field( 'verkaufspreis' ) ): ?&gt; 
                  &lt;p&gt;&lt;?php the_field('verkaufspreis'); ?&gt;&lt;/p&gt;
              &lt;?php endif; ?&gt; 
          &lt;/div&gt;
      &lt;/article&gt;
  
  &lt;?php endwhile; ?&gt;                          
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p></p>