2012-03-21 6 views
0

를 작동하지 않는 동안 나는 약간의 정보를 정기적으로 보여주기 위해 노력하고있어, 나는 한 번만 사업부를 만들려면, 그 후에 바로 내용루프가 제대로

<?php while ($loop1->have_posts()) : $loop1->the_post(); ?> 
<?php if($cnt == 0): echo "<div class=\"big-image\">";endif; ?> 
    <img src="<?php echo get_post_meta(get_the_ID(),'details_artists_image',true);?>" height="414" width="810" style="display:none"/> 
<?php if($cnt ==0): echo "</div><!--end big-image--><ul class=\"artiesten-thumbs clearfix\">";endif; ?> 
<li> 
    <a href="<?php echo get_post_meta(get_the_ID(),'details_artists_image',true);?>"><img width="99" height="99" src="<?php echo get_post_meta(get_the_ID(),'details_artists_image',true);?>" alt=""></a> 
    <span><?php the_title(); ?></span> 
</li> 
<?php $cnt++; endwhile; ?> 
</ul> 
를 표시

문제는 출력은 다음과 같습니다이다 :

<div class="big-image"><img src="url" ... /></div> 
<ul class="artiesten-thumbs"> 
<li> 
<a href="url"><img width="99" height="99" src="url" alt=""></a> 
<span>LP &#038; BRUGE</span> 
</li> 
<img again that should be in <div class="big-image" 
<li> 
<a href="url"><img width="99" height="99" src="url" alt=""></a> 
<span>LP &#038; BRUGE</span> 
</li> 
<img again that should be in <div class="big-image" 

그래서 각 <li>

+0

와우 이것은 정말로 혼란 스럽지만, 당신이하고 싶은 것은 while 루프를 이미지에 대해 한 번, 콘텐츠에 대해 한 번 실행하는 것입니다. 또는 이미지에 하나를 사용하고 내용에 대해 루프를 사용하는 동안 html 문자열을 2 개의 변수로 분리하십시오. 희망이 도움이 – mseancole

답변

1

한 후에는 모든 IT의 이미지를 인쇄하는, 그들 하나 하나를 보여줍니다 사업부에 있어야 이미지를 표시하지 않습니다 eration. 당신은 이런 것을 원합니다.

<?php if($cnt == 0) : ?> 
    <div class="big-image"> 
     <img src="<?php echo get_post_meta(get_the_ID(),'details_artists_image',true);?>" height="414" width="810" style="display:none"/> 
    </div><!--end big-image--> 

    <ul class="artiesten-thumbs clearfix"> 
<?php endif; ?> 
관련 문제