I have a query post for my CPT 'listing' that order posts by value of price contained on meta key.

Now I'd like to add the possibility to show in the loop first posts that has a specific tag (o whatever else - for example a different meta value). Since that sticky post works well on standard post only, I'd like to implement this with a work aroud.

I have the following query:

$args = array(  
    'post_type' => 'listing',
    'post_status' => 'publish',
    'posts_per_page' => 20, 
    'meta_key'  => 'price',
    'orderby' => 'meta_value_num',
    'meta_type' => 'NUMERIC',
    'order' => 'ASC',       

Is possible to show first the posts that have taxonomy 'PRO' with term 'yes' and after show the posts have taxonomy 'PRO' with term as 'no'?

Or something other way (for example with additional custom field)?

  • someone can help me?
    – Giulio
    Nov 29 '21 at 12:31
  • To be honest, I would just use 2 loops - first to get the highlighted entries, and then the current one with post__not_in to fetch the rest.
    – kero
    Nov 29 '21 at 14:25
  • @kero honestly I thought at this solution... But If there is a possibility to include all condition in one query post, I prefer that solution....
    – Giulio
    Nov 29 '21 at 16:29
  • someone have solution creating just one query post?
    – Giulio
    Nov 30 '21 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.