<img src="<?php echo get_post_image() ?>" alt="<?php the_title(); ?>" />
yukarıdaki sayfada göstereceğin resim kodu index.php ye yerleştireceğin kod
fonctions dosyasının en başına aşagıdaki kodu ekle
<?php
function resimsec() {
global $post, $posts;
$resimbir = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$resimbir = $matches [1] [0];
return $resimbir;
}
function get_post_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$img_dir = get_bloginfo('template_directory');
$first_img = $img_dir . '/images/post-default.jpg';
}
return $first_img;
}
?>resimi cerceve içine alıp boyurlandırmak için
<div class="post">
gibisinden bir div kodu olur
onuda css dosyasına şu şekil eklersin.
.post img {
width: 180px;
height: 180px;
float:left;
border:2px solid #ccc;
padding:1px;
margin-bottom: 1px;
margin-right:1px;
margin-left:2px;
margin-top:1px;
}
post yazısını css koduna göre değiştirisen ana sayfada eklenti kullanmadan resim görünür eklenti gibi siteyi yavaşlatmaz.