• 03-09-2018, 19:10:15
    #1
    Herkese merhaba,

    Başlık biraz karışık olmuş olabilir, aşağıdaki gibi bir döngü var. Son 5 içeriğin başlığını çekebiliyorum fakat sadece en son eklenen içerikte görsel göstermek istiyorum, yardımcı olabilecek var mıdır?

    <ul>
    <?php $the_query = new WP_Query( array( 'cat' => '1', 'posts_per_page' => 5 ) ); ?>
     
    <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
     
    <li>
    
    <?php if ( has_post_thumbnail()) :  ?>
    <?php the_post_thumbnail(array(230,163)); ?>
    <?php endif; ?>
    
    <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    
    <?php
    endwhile;
    wp_reset_postdata();
    ?>
    </ul>
    Örnek görsel: http://prntscr.com/kq4nha
  • 03-09-2018, 21:26:54
    #2
    <ul>
    <?php $i = 0; $the_query = new WP_Query( array( 'cat' => '1', 'posts_per_page' => 5 ) ); ?>
      
    <?php while ($the_query -> have_posts()) : $the_query -> the_post(); $i++; ?>
      
    <li>
     
    <?php if ( $i == 1 ) { if ( has_post_thumbnail()) :  ?>
    <?php the_post_thumbnail(array(230,163)); ?>
    <?php endif; } ?>
     
    <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
     
    <?php
    endwhile;
    wp_reset_postdata();
    ?>
    </ul>
    Dener misin?
  • 04-09-2018, 10:21:23
    #3
    Oldu, geçen sefer de hayatımı kurtarmıştınız, çok teşekkürler.