Skip to content

Instantly share code, notes, and snippets.

@davidperezgar
Created December 24, 2014 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidperezgar/7b2d66456a054b6d25b1 to your computer and use it in GitHub Desktop.
Save davidperezgar/7b2d66456a054b6d25b1 to your computer and use it in GitHub Desktop.
Latests posts with bootstrap
<div class="row latestposts">
<?php
$args = array(
'posts_per_page' => 2
);
$postlist =get_posts($args);
foreach($postlist as $post){
setup_postdata( $post );
?>
<div class="col-md-4">
<?php the_post_thumbnail( 'wpbs-featured' ); ?>
</div>
<div class="col-md-8">
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
<header>
<h3 class="h2"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</header> <!-- end article header -->
<section class="post_content">
<?php the_excerpt(); ?>
</section> <!-- end article section -->
<footer>
<p class="meta"><?php _e("Posted", "wpbootstrap"); ?> <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time(); ?></time> <?php _e("by", "wpbootstrap"); ?> <?php the_author_posts_link(); ?> <span class="amp">&</span> <?php _e("filed under", "wpbootstrap"); ?> <?php the_category(', '); ?>.</p>
</footer> <!-- end article footer -->
</article> <!-- end article -->
</div>
<?php } wp_reset_postdata(); //foreach ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment