Skip to content

Instantly share code, notes, and snippets.

@lschatzkin
Last active August 29, 2015 14:23
Show Gist options
  • Save lschatzkin/1fd7baf72cc1d7e03764 to your computer and use it in GitHub Desktop.
Save lschatzkin/1fd7baf72cc1d7e03764 to your computer and use it in GitHub Desktop.
<?php
//Nature News loop, featured article with thumbnail
$args = array (
'posts_per_page' => '1',
'page_id' => '4444'
);
$query = new WP_Query( $args );
echo '<h3 class="title">The Title</h3>';
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
echo '<div class="featured-image">';
echo ' <a href="'.get_permalink().'"><img src="' . get_thumb_url(get_thumbnail_src($post->ID),300,200) . '" alt="" /></a>';
echo '</div>';
echo '<h4><a href="' . get_permalink() .'">'. get_the_title() . '</a></h4>';
echo '<p>'. the_excerpt(). '</p>';
}
} else {
echo '<h3> Sorry, no posts found</h3>';
}
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment