Leave a Reply

2 comments

  1. <?php
    // query posts
    $query_property = query_posts( array( 
         'orderby'    => 'date meta_value' // orderby date AND meta value
    ) );
    
    // First loop
    $query_feat = $query_string.'&meta_value=on&meta_key=property_featured';
    // Offset for second loop
    $query_all = $query_string.'&offset=3&meta_key=property_featured';
    
    // First loop
    if ( $query_feat->have_posts() : while ( $query_feat->have_posts() ) : # etc....
        // do stuff
    endif;
    
    // Second loop
    if ( $query_all->have_posts() : while ( $query_all->have_posts() ) : # etc....
        // do stuff
    endif;
    ?>
    
  2. I think what you are trying to do her is a little too complex. Essentially you want two (meta and date) sort orders applied. Also I think that order by meta value will not work for posts that don’t have that value at all.

    Stickes is accurate comparison, but note that they are not handled by SQL request, but by completely separate code – they are re-ordered, fetched and applied to results of already completed query.

    Unless you want to fork and rewrite stickes logic I think the easiest way would be to move your featured posts to separate loop.