seen from Japan
seen from Poland
seen from China

seen from India

seen from Germany
seen from Netherlands
seen from China
seen from Netherlands
seen from United States
seen from China

seen from Australia
seen from Poland
seen from China

seen from Australia
seen from Philippines

seen from Uruguay
seen from China
seen from China
seen from Canada
seen from United States

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Ordering WP_Query by custom field value and keeping pagination
On a recent client site that sales aircraft engines, our client wanted to keep all engines on the site, even if they had been sold. Note that the site is not e-commerce as of yet, we are only displaying inventory with a contact button at this time.
The other thing the client requested was that all items that have been sold be last in the inventory grid. He also wanted to only show 9 products per page and paginate it.
We first added a custom field to the ‘engine’ custom post type — a radio button (engine_sold) with two values: ‘Available’ and ‘Sold’. As engines are sold, the client staff can login to the site and change the status of the engine to Sold with a simple tick of the radio button and saving the post.
Where things got tricky was trying to get engines with the ‘Available’ status as well as the ‘Sold’ status in the same WP_Query, so we could have them in the same grid. And on top of that, we had to be sure the ones marked ‘Sold’ showed last, and that we kept our pagination.
By using WP’s meta_query, we were able to call two arrays in the same call.
Here’s how we did it:
$args = array( 'post_type' => 'engine', 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'engine_sold', 'compare' => '=', 'value' => 'Available' ), array( 'key' => 'engine_sold', 'value' => 'Sold', 'compare' => '=' ) ), 'meta_key' => 'engine_sold', 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => '9', 'paged' => $paged ); $wp_query = new WP_Query( $args );
Anyone else had this problem? It took about 3 hours of researching to finally get to a solution. A big thanks to CSSgirl on StackExchange for the solution: http://wordpress.stackexchange.com/questions/126772/query-to-sort-a-list-by-meta-key-first-if-it-exists-and-show-remaining-posts