Created
November 8, 2016 09:33
-
-
Save CEscorcio/893b36dd63790ac43d629b4c437c6443 to your computer and use it in GitHub Desktop.
Wordpress recent posts with thumb check
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
<ul> | |
<?php $the_query = new WP_Query( 'posts_per_page=2' ); ?> | |
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> | |
<li class="col-md-6"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> | |
<?php | |
if ( has_post_thumbnail() ) { | |
the_post_thumbnail(); | |
} | |
else { | |
echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) | |
. '/images/thumbnail-default.jpg" />'; | |
} | |
?> | |
<?php the_excerpt(__('(Ler mais..)')); ?> | |
</li> | |
<?php | |
endwhile; | |
wp_reset_postdata(); | |
?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment