Last active
August 29, 2015 14:23
-
-
Save lschatzkin/1fd7baf72cc1d7e03764 to your computer and use it in GitHub Desktop.
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 | |
//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