Reputation: 15
I am working on the home page of this site.
I have successfully placed a featured image thumbnail of the latest blog post in the 3rd column on the right. I am not trying to make the first column featured image thumbnail come from a custom post type I've created called portfolio_item
I've used the following code to place the blog post featured image:
<?php query_posts('showposts=1'); ?>
<?php while (have_posts()): the_post(); ?>
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' ); ?>
<a href="/wpsite/blog"><img class="aligncenter circle" alt="" src="<?php echo $image[0]; ?>" /></a>
<?php endif; ?>
<?php endwhile;
wp_reset_query();
?>
What do I need to change to make it retrieve the featured image for the latest post in the custom post type portfolio_item
?
Upvotes: 0
Views: 187
Reputation: 919
query_posts(array ( 'showposts' => 1 , 'post_type' => 'portfolio_item') );
Upvotes: 0