Last active
December 8, 2015 15:05
-
-
Save ethanclevenger91/7f8d56ff680726b82fef to your computer and use it in GitHub Desktop.
Text editor snippets for Wordpress's loop and a new WP_Query
This file contains hidden or 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
'.source.php': | |
'The Loop': | |
'prefix': 'theloop' | |
'body': "if($1->have_posts()): while($1->have_posts()): $1->the_post();" | |
'New WP_Query': | |
'prefix': 'wpquery' | |
'body': """ | |
$1 = new WP_Query(['post_type'=>$2, 'posts_per_page'=>-1, 'orderby'=>'menu_order', 'order'=>'ASC']); | |
if($1->have_posts()): while($1->have_posts()): $1->the_post(); | |
endwhile; endif; wp_reset_postdata(); | |
""" |
This file contains hidden or 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
<snippet> | |
<content><![CDATA[ | |
if(${1}->have_posts()) : while(${1}->have_posts()) : ${1}->the_post(); | |
endwhile; endif; | |
wp_reset_postdata(); | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>theloop</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.php</scope> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment