Created
May 21, 2012 13:02
-
-
Save gvinter/2762209 to your computer and use it in GitHub Desktop.
correct query for posts
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
<?php | |
$args = array( 'numberposts' => 3 ); | |
$posts = get_posts( $args ); | |
?> | |
<ul> | |
<?php foreach( $posts as $post ) : setup_postdata($post); ?> | |
<li class="grid_4 alpha omega"> | |
<a href="<?php the_permalink(); ?>"> | |
<?php if ( has_post_thumbnail('<thumnail-name>') ): ?> | |
<?php the_post_thumbnail('<thumnail-name>'); ?> | |
<?php else: ?> | |
<img src="http://placehold.it/300x145" alt=""> | |
<?php endif; ?> | |
<div class="post-text"> | |
<?php the_title(); ?> | |
<?php the_excerpt(); ?> | |
</div> | |
</a> | |
</li> | |
<?php endforeach; ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment