2014-02-11 1 views
0

나는 커스텀 포스트 타입을 가진 wordpress 포트폴리오를 만들고있다. 페이지에는 이미지의 미리보기 이미지가 표시되며 이미지 위에 마우스를 가져 가면 제목, 발췌 부분 및 링크가 표시되어 라이트 박스에서 게시물의 내용을 볼 수 있습니다. Lightbox를 얻으려면 LightBox Plus ColorBox라는 플러그인을 사용하고 있습니다. 어떤 이유로 라이트 박스는 클릭 한 작은 이미지와 관련된 콘텐츠를 표시하는 대신 모든 게시물 라이트 박스에 가장 최근 게시물의 콘텐츠를 표시합니다.라이트 박스에서 Wordpress 루프가 제대로 작동하지 않습니까?

웹 사이트의 URL은 http://www.ginahughes.co.uk

이 내 페이지 코드입니다 :

<div id="portfolio"> 

<div class="group"> 

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 

    <?php 
     $title= str_ireplace('"', '', trim(get_the_title())); 
     $desc= str_ireplace('"', '', trim(get_the_content())); 

    ?>  


      <div class="bp-wrapper"> 
       <a title="<?=$title?>: <?=$desc?>" href="<?php the_permalink() ?>"><?php the_post_thumbnail('portfolio-thumb'); ?></a> 

        <div class="bp-post-details"> 
         <a title="<?=$title?>: <?=$desc?>" rel="lightbox" href="<?php the_permalink() ?>"> 
         <h4> 
          <a class="lbp-inline-link-1 cboxElement" href="#"> 
           <?=$title?></a></strong></h4> 
         <p><?php print get_the_excerpt(); ?></p> 
         </a> 



        </div> 

      </div> 
      <div style="display: none;"> 
      <div id="lbp-inline-href-1" style="padding:10px; "> 
       <?php the_content(); ?> 
      </div> 
     </div> 








<?php endwhile; endif; wp_reset_query(); ?> 

</div> 

</div> 

답변

0

것은 그가 문제를 해결 할 수

<div id="portfolio"> 

<div class="group"> 

    <?php 
$i=1; 
if (have_posts()) : while (have_posts()) : the_post(); ?> 

    <?php 
     $title= str_ireplace('"', '', trim(get_the_title())); 
     $desc= str_ireplace('"', '', trim(get_the_content())); 

    ?>  


      <div class="bp-wrapper"> 
       <a title="<?=$title?>: <?=$desc?>" href="<?php the_permalink() ?>"><?php the_post_thumbnail('portfolio-thumb'); ?></a> 

        <div class="bp-post-details"> 
         <a title="<?=$title?>: <?=$desc?>" rel="lightbox" href="<?php the_permalink() ?>"> 
         <h4> 
          <a class="lbp-inline-link-<?=$i?> cboxElement" href="#"> 
           <?=$title?></a></strong></h4> 
         <p><?php print get_the_excerpt(); ?></p> 
         </a> 



        </div> 

      </div> 
      <div style="display: none;"> 
      <div id="lbp-inline-href-<?=$i?>" style="padding:10px; "> 
       <?php the_content(); ?> 
      </div> 
     </div> 








<?php $i++;endwhile; endif; wp_reset_query(); ?> 

</div> 

</div> 

같은 동적 뭔가하는 클래스와 ID를 교체

+1

정말 고마워요! 이제 관련 게시물 내용이 표시됩니다. CSS 스타일링은 첫 번째 게시물에서 약간 다르지만 이후 수정 될 수 있습니다. 귀하의 도움을 많이 주시면 감사하겠습니다. – digitalitea

+0

(y) .. 그걸 알고 좋은 :). 그리고 나에게 3 명의 사람의 밖에 도움이되는 것을 감사해라.) jai ho !! – anstrangel0ver