Created
April 22, 2013 18:14
-
-
Save nashvillegeek/5437215 to your computer and use it in GitHub Desktop.
Wordpress: Recent Posts Script
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
<snippet> | |
<content><![CDATA[ | |
<div class="recentPost widget"> | |
<h2>Recent Posts:</h2> | |
<?php | |
global \$post; | |
\$args = array( 'numberposts' => ${1:5},'category' => ${2:'uncategorized'} ); | |
\$myposts = get_posts( \$args ); | |
foreach( \$myposts as \$post ) : setup_postdata(\$post); ?> | |
<div class="recentPostItem"> | |
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> | |
<?php the_excerpt(); ?> | |
</div><!-- end .recentPostItem --> | |
<?php endforeach; wp_reset_query(); ?> | |
</div><!-- end .homeRecentPost--> | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>wp-recent-post</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<!-- <scope>source.python</scope> --> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment