Support » Fixing WordPress » Show thumbnails if they exist, otherwise excerpts

  • 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">
    	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>
    	<!-- end post -->

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

    Many thanks

  • The topic ‘Show thumbnails if they exist, otherwise excerpts’ is closed to new replies.