The Quickest Way to Create Custom WordPress Queries

WordPress Query Generator: The quickest way to generate custom queries
When working with WordPress templates for posts and pages, WP_Query allows you to customize and order the information you want to display. The WordPress Query Generator is a new web application, created by the folks at Spruce Interactive. It’s a very useful tool for quickly spitting out customized queries to use in your templates.

The generator lets you easily select post status, type, order, etc via a dropdown menu. You can also type in your own categories and tags.

Here’s a sample query generated:

{code type=php}
‘publish’,
‘post_type’ => ‘post,attachment’,
‘order’ => ‘ASC’,
‘order_by’ => ‘comment_count’,
‘cat’ => ‘debates’,
‘tag’ => ‘LD’,
‘posts_per_page’ => ’10’,
‘offset’ => ‘1’,
‘paged’ => (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1
));

?>
{/code}

This tool completely simplifies the process of creating custom queries. No need to dig into the codex and piece it together. In the future the creators of the generator plan to support criteria such as taxonomy and custom fields. Bookmark the WordPress Query Generator and check back for updates to create more advanced queries.