TeknoGame adlı üyeden alıntı:
mesajı görüntüle
//thumbnail resim gosterme
function resimgoster() {
global $post, $posts;
$resimbir = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$resimbir = $matches [1] [0];
if(empty($resimbir)){ //Eğer resim yoksa
$resimbir = "http://www.domain.com/empty.png";
}
return $resimbir;
}Ayrıca home.php'deki<?php if( get_post_meta($post->ID, "thumbnail", true) ): ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="<?php the_title(); ?>" width="70" height="70"/></a>
<?php else: ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php bloginfo('template_url'); ?>/images/thumbnail.png" alt="<?php the_title(); ?>" /></a>
<?php endif; ?>kodunu silip aşağıdakiyle değiştirmen gerek;<a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php echo resimgoster() ?>" alt="<?php the_title(); ?>" width="90" height="90"/></a>