WordPress.org

Ready to get started?Download WordPress

Forums

Show thumbnails if they exist, otherwise excerpts (1 post)

  1. probably_stumped
    Member
    Posted 3 years ago #

    Hi

    I'm trying to get my index and archive pages to display the thumbnails only if a picture exists in the post. Otherwise I'd like just a post excerpt OR nothing at all except the permalink to the title.

    Here's the code I currently have:

    <div id="content">
    
    	<?php
    	if (have_posts()) :
    	while (have_posts()) : the_post();
    	?>
    
    	<!-- begin post -->
    	<div class="post">
    		<div class="thumb"><div><a href="<?php the_permalink(); ?>"><?php dp_attachment_image($psot->ID, 'medium', 'alt="' . $post->title . '"'); ?></a></div></div>
    
    		<p class="date">Posted on <?php the_time('F j, Y') ?> by <?php the_author_posts_link(); ?></p>
    		<?php the_excerpt(); ?>
    		<a class="continue" href="<?php the_permalink(); ?>">Continue Reading</a>
    	</div>
    	<!-- end post -->

    Can anyone point me in the right direction to creating the right conditional here please?

    Many thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by probably_stumped
  • This topic is not resolved
  • WordPress version: 3.0.1