
Resimde görülen konuların
Resmi Yerine konu içinde açıp ve kendi koyduğum resimleri nasıl görüntüleyebilirim.
Aynı aşağıdaki gibi
5
●330
<?php $resim = get_post_custom_values("resim"); echo $resim[0]; ?>Kolay gelsin.
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)){ //Eger resim eklememisseniz
$resimbir = "/images/default.jpg";
}
return $resimbir;
}ekliyoruz daha sonra <div id="homepageleft">
<div class="hpfeatured">
<h3>Yabanci Sinema izle</h3>
<?php $recent = new WP_Query("cat=33&showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
<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="110" height="80" /></a>
<b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b><br />
<?php the_content_limit(30, "[devami]"); ?>
<div style="border-bottom:1px dotted #94B1DF; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div>
<?php endwhile; ?>
</div>
</div>Bu sekilde yapiyoruz onemli olan src= ile getirmek icin asagidaki kodu ekliyoruz.<?php echo resimgoster() ?>"Konu icerisindeki resmi getiriyor.