ivanlar adlı üyeden alıntı: mesajı görüntüle
Selamlar,

Aşağıdaki kodlamada resimlere alt="" etiketi koymak istiyorum ama beceremedim.

Yardımcı olabilir misiniz?
Teşekkürler


<?php
   $recent_posts = homePageTelf();

   foreach( $recent_posts as $recent ){
    $imageTel = get_the_post_thumbnail($recent->ID, 'medium', array( 'class' => 'img-thumbnail' )); ?>
    <div class="item topic"> <a title="<?php echo $recent->post_title; ?>" href="<?php echo post_permalink( $recent->ID ); ?>">
     <?php echo $imageTel; ?>

     <h5><?php echo $recent->post_title; ?></h5>

    </a> </div>
    <?php		} wp_reset_query(); ?>


 <?php
   $recent_posts = homePageTelf();

   foreach( $recent_posts as $recent ){
$attr = array(
			'class'	=> "img-thumbnail",
			'alt'	=> trim(strip_tags( $attachment->post_excerpt )),
		);
    $imageTel = get_the_post_thumbnail($recent->ID, 'medium',  $attr); ?>
    <div class="item topic"> <a title="<?php echo $recent->post_title; ?>" href="<?php echo post_permalink( $recent->ID ); ?>">
     <?php echo $imageTel; ?>

     <h5><?php echo $recent->post_title; ?></h5>

    </a> </div>
    <?php        } wp_reset_query(); ?>
'alt' => trim(strip_tags( $attachment->post_excerpt )), olan kısım resme alt tagını attchment in özeti olarak ekler, değiştirebilirsiniz.