Query Posts With Over 1000 Views

This should work, but I didn’t have the time to test it. $query = new WP_Query( array( ‘meta_key’ => ‘_hit-counter’, ‘meta_value’ => ‘1000’, ‘meta_compare’ => ‘>=’, ‘orderby’ => ‘date’ ) );

Gallery shortcode numerical sorting

It doesn’t look like you can do this with the gallery shortcode, unfortunately. The Codex doesn’t even list meta_value_num as an option (though that doesn’t mean it couldn’t work.) However, you’re correct, you must specify a meta-key to use that ordering scheme with WP_Query.

Pre-Populate $wp_query settings with custom rewrite rules and custom template_redirect

I’ve probably found the solution for the above problem. To pre-populate the global variable $wp_query you have to run the query_posts() function with the correct arguments and reset the $wp_query->post with the function wp_reset_postdata(). This must be done on the template_redirect hook or earlier. class Webeo_Download { protected $downloadId; protected $action; public function setup() { … Read more