갤러리 필드 추가 기능 및 팬시 박스와 함께 고급 사용자 정의 필드를 사용하고 있습니다. 시청자가 미리보기 이미지를 클릭하면 Fancybox 슬라이드 쇼가 나타납니다. 문제는 미리보기 이미지가 표시되지 않는다는 것입니다. 요소를 검사 할 때 어떤 이유로 img 크기가 0x0입니다.고급 사용자 정의 필드 갤러리 필드 이미지가 표시되지 않음
여기 내 코드입니다 :
<div id="post-img">
<?php
$images = get_field('gallery');
$image_1 = $images[0];
?>
<?php foreach($images as $image): ?>
<a href="<?php echo $image['url']; ?>" rel="fancybox">
<h5>view images</h5><img src="<?php echo $image_1['url']; ?>"/>
</a>
<?php endforeach; ?>
</div><!-- #post-img -->
CSS :
#post-img {
float:left;
margin-bottom:0;
padding-top:10px;
padding-bottom:0;
}
#post-img a {
display:none;
}
#post-img img {
display:none;
width:200px;
height:auto;
}
#post-img a:first-of-type img{
display:block;
}
고맙습니다. 단 하나의 축소판을 표시하고 싶었지만 그 다음에 '# post-img a : first-child {display : block;}'을 추가하는 것을 잊어 버렸기 때문에 코드를 추가했습니다. 이제 작동합니다. –