Created
February 1, 2014 19:42
-
-
Save brandonhimpfen/8757590 to your computer and use it in GitHub Desktop.
Creates a list group of the last 5 posts in WordPress, using Twitter's Bootstrap panel. More or less of 5 posts? Change line 2.
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
echo '<div class="panel panel-default"><div class="panel-heading">Last Five Posts</div><div class="panel-body"><p>Here are the latest posts:</p></div><ul class="list-group nav">'; | |
$args = array( 'numberposts' => '5' ); | |
$recent_posts = wp_get_recent_posts( $args ); | |
foreach( $recent_posts as $recent ){ | |
echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="'.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> '; | |
} | |
echo '</ul></div>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment