• I need to do a query ( with query_posts or wp_query ) that set some elements at the end of the posts array.

    For example i have these elements:

    1) blue
    2) red
    3) green
    4) red
    5) green
    6) green
    7) blue
    8) green
    9) blue
    10) red
    11) red
    12) blue

    And im looking for a query that set on this way: ( ex. last elements: red )

    1) blue
    2) green
    3) green
    4) green
    5) blue
    6) green
    7) blue
    8) blue
    9) red
    10) red
    11) red
    12) red

    What should i do? Thanks for all!

Viewing 16 replies (of 16 total)
  • Thread Starter Iperdesign_IT

    (@iperdesign_it)

    Nothing happen ??

    Well never mind, i’ll use a workaround:

    $args=array(
    	'post_type' => $type,
    	'paged' => $paged,
    	'posts_per_page' => 5,
    	'orderby'	=>	'meta_value',
    	'meta_key'	=>	'Stato',
    	'order'		=>	'ASC'
    );

    So all ‘sold’ and ‘booked’ are in the last positions ( and my customer has no problem with this solution )

    By the way i’ll try on holidays to solve this problem ??

    Thanks for all keesiemeijer ??

Viewing 16 replies (of 16 total)
  • The topic ‘How to create a query that set some elements at the end of the returned array’ is closed to new replies.