Created
July 8, 2014 19:45
-
-
Save jdcauley/88f6524efef4e4451e5b to your computer and use it in GitHub Desktop.
Recent Post Loop
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
<?php $the_query = new WP_Query('showposts=3'); ?> | |
<?php if ( $the_query->have_posts() ) : ?> | |
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> | |
<div class="recent-post-wrapper"> | |
<?php if (has_post_thumbnail()): ?> | |
<div class="recent-post-img"> | |
<?php the_post_thumbnail('', array('class' => 'img-responsive')); ?> | |
</div> | |
<div class="recent-post-copy"> | |
<h4><?php the_title(); ?></h4> | |
<p><?php echo excerpt(15); ?></p> | |
</div> | |
<a class="btn btn-secondary btn-xs" href="<?php the_permalink(); ?>">Read More</a> | |
<?php else: ?> | |
<h4><?php the_title(); ?></h4> | |
<p><?php echo excerpt(15); ?></p> | |
<a class="btn btn-default btn-xs" href="<?php the_permalink(); ?>">Read More</a> | |
<?php endif; ?> | |
</div> | |
<?php wp_reset_postdata(); ?> | |
<?php endwhile; ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment