Use Featured Image For Thumbnail In My Archives
-
Right now my theme requests that I insert the specific file location for the image I want to use for my thumbnail when viewing the archives (in a special field box). However, I would rather my theme simply use the image that has been designated as my “Featured Image” (I used a plugin that automatically set my first image in each post as my “Featured Image”, therefore, I’d like all those old posts to display that thumbnail.)
Here is the code in my Archives.PHP theme that is pulling the image:
?php } ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class=”post”><?php if(get_post_meta($post->ID, ‘post_thumbnail_value’, true) != ”) { ?>
“><img class=”post-image” src=”<?php bloginfo(‘template_directory’) ?>/timthumb.php?src=<?php echo get_post_meta($post->ID, ‘post_thumbnail_value’, true); ?>&w=154&h=154&zc=1″ alt=”<?php the_title(); ?>” />
<?php } ?>
<h2 class=”post-title”>“><?php the_title(); ?></h2>
<div class=”postmetadata”>
<p class=”date”>Posted on <?php the_time(‘F d, Y’); ?> by <?php the_author_link(); ?></p>
</div>
- The topic ‘Use Featured Image For Thumbnail In My Archives’ is closed to new replies.