• 31-08-2013, 18:59:29
    #1
    	<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.
  • 31-08-2013, 19:39:01
    #2
    while nin önüne $i=0;

    while'nin içine $i++;

    class ın olduğu yere if($i==1){echo ' class="aktifResim"';}
  • 31-08-2013, 19:52:20
    #3
    kod üzerinden yapmamız mümkün mü hata aldım ben.
  • 31-08-2013, 20:05:30
    #4
    	<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>
  • 31-08-2013, 20:09:12
    #5
    çok teşekkürler