• 13-05-2010, 01:36:30
    #1
    mre
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Internetten buldugum su codeu kullanarak konulardaki ilk resimleri thumbnail halinde kullaniyorum da istedigim sey su kategorideki mesajlari listeledigimde 5 konu icin 5 adet resim geliyor yani 5 konunun icindeki 5 resim gozukuyor. Ben sadece en son konunun resimini almak istiyorum. yardimci olabilecek varmi


    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 eklememişseniz
    $resimbir = "/images/default.jpg";
    }
    return $resimbir;
    }


    <img src="<?php echo resimgoster() ?>" />
  • 13-05-2010, 02:25:12
    #2
    eminim daha duzgun bir yolu vardir ama biraz beyin firtinasi yaparak boyle bi cozum buldum.

    <?php $recent = new WP_Query("cat=202&showposts=1"); while($recent->have_posts()) : $recent->the_post();?><img src="<?php echo resimgoster() ?>" alt="" /><?php endwhile; ?>
    <?php $recent = new WP_Query("cat=202&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>