Created
January 16, 2015 06:02
-
-
Save raewrites/f517d958c25ebb776888 to your computer and use it in GitHub Desktop.
Display List of Featured 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( | |
'post_type' => 'post', | |
'posts_per_page' => '4', | |
'post__not_in' => array( $post->ID ) | |
); | |
// the query | |
$query = new WP_Query( $args ); | |
// The Loop | |
if ( $query->have_posts() ) { ?> | |
<section class="recent-posts clear"> | |
<?php while ( $query->have_posts() ) : $query->the_post() ; ?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class( 'left' ); ?>> | |
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> | |
<?php post_thumbnail( 'thumbnail' );?> | |
</a> | |
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</article> | |
<?php endwhile; ?> | |
</section> | |
<?php } | |
/* Restore original Post Data */ | |
wp_reset_postdata(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment