<div class="res">
<h2>Kategori İsmi</h2>
<ul>
<?php query_posts('showposts=5&orderby=date&cat=1'); ?>
<li>
<div class="resimgoster"></div>
</li>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
<img src="<?php echo get_post_meta($post->ID, "resim", true); ?>" alt="<?php the_title(); ?>" class="aktifResim"/>
</a>
</li>
<?php endwhile; ?>
</ul>
</div>kodda sadece ilk resme class="aktifResim" uygulamak istiyorum. nasıl yapabilirim.
while döngüsü yardım
4
●302
- 31-08-2013, 18:59:29
- 31-08-2013, 20:05:30
<div class="res"> <h2>Kategori İsmi</h2> <ul> <?php query_posts('showposts=5&orderby=date&cat=1'); ?> <li> <div class="resimgoster"></div> </li> <?php $i=0; while (have_posts()) : the_post(); $i++; ?> <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?> <img src="<?php echo get_post_meta($post->ID, "resim", true); ?>" alt="<?php the_title(); ?>"<?php if($i==1) { echo ' class="aktifResim"'; } ?>/> </a> </li> <?php endwhile; ?> </ul> </div>