/** * * 是否有文章有第一张图片 */ function has_first_image() { $first_img = fun_first_image(); if (empty($first_img)) { return false; } return true; }
?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <?php the_post_thumbnail('thumbnail-list', array('alt' => trim(strip_tags($post->post_title)), 'title' => trim(strip_tags($post->post_title)))); ?> </a> <?php } elseif (has_first_image()) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><img src="<?php echo fun_first_image(); ?> " /></a> <?php } ?> </div> </div>