Created
July 20, 2012 23:46
-
-
Save mattbanks/3153899 to your computer and use it in GitHub Desktop.
Create new WP_Query with TextExpander (version 4 required)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// New query | |
$%filltext:name=Query Name:default=myquery%_args = array( | |
'post_type' => '%filltext:name=Post Type:default=post%', | |
'order' => '%fillpopup:name=popup 7:default=ASC:DESC%', | |
'orderby' => '%fillpopup:name=popup 9:default=date:ID:rand:title:author:menu_order%', | |
'post_status' => 'publish', | |
'posts_per_page' => %filltext:name=Posts Per Page:default=-1% | |
); | |
$%filltext:name=Query Name:default=myquery% = new WP_Query( $%filltext:name=Query Name:default=myquery%_args ); | |
if ($%filltext:name=Query Name:default=myquery%->have_posts()) : while ($%filltext:name=Query Name:default=myquery%->have_posts()) : $%filltext:name=Query Name:default=myquery%->the_post(); ?> | |
<!-- do stuff here --> | |
<?php endwhile; ?> | |
<?php else : ?> | |
<!-- No Results stuff here --> | |
<?php endif; ?> | |
<?php wp_reset_postdata(); ?> ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment