3 열을 표시해야하는 갤러리가 있습니다. 처음 두 열은 특정 클래스가 있으며 절대적으로 잘 작동하지만 제 3 열에 "마지막 클래스"를 추가하려고합니다. 작동 안함. 아래 코드 찾기 :Wordpress 마지막 클래스가 작동하지 않습니다.
<?php
$mod =1;
if ($images = get_posts(array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'numberposts' => -1,
'post_mime_type' => 'image',)))
{
foreach($images as $image) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image_src($image->ID, full);
$imageDescription = apply_filters('the_description' , $image->post_content);
$imageTitle = apply_filters('the_title' , $image->post_title);
if ($mod % 3 == 0) {
$class = "gallery-entry-img-last";
}else{
$class = "gallery-entry-img";
}
echo '<div class="'.$class.'"><div class="gallery-entry-img-l"><a rel="next" href="' . $attachmentimage[0] . '"><span class="rollover" ></span><img src="library/tools/timthumb.php?src=' . $attachmentimage[0] . '&w=270&h=198" alt="" /></div></div>';
}
$mod++;
}
else {
echo "No Image";
}
?>
일부 전문가는 크게 감사드립니다.
가 잘못된 클래스를 인쇄하거나 아무것도 인쇄하지 않습니다? –
답장을 보내 주셔서 감사합니다. gallery-entry-img-last 대신 "gallery-entry-img"에 인쇄하고 있습니다. –