2016-05-19 5 views
0

ページにレンダリングされないこのコードがあります。誰が問題が何であるか知っていますか?アドバンストカスタムフィールドがワードプレスページに表示されない

<div class="b b--alt"> 
    <div class="container"> 
    <div class="tab-widget tab-widget--team js-tab-widget"> 
     <?php if(have_rows('the_commusoft_story')) { ?> 
     <?php $i = 0; ?> 
     <ul class="tab-widget__list"> 
     <?php while(have_rows('the_commusoft_story')): the_row(); ?> 
      <?php $i++ ?> 
         <li class="tab-widget__item"> 
      <a href="#tab-panel-<?php echo $i; ?>" class="tab-widget__link"> 
           <span class="ss-icon <?php the_sub_field('icon'); ?>"></span> 
           <h2><?php the_sub_field('section_title'); ?></h2> 
           <?php the_sub_field('section_description'); ?> 
      </a> 
      </li> 
         <?php endwhile; ?> 
     </ul> 
       <?php }; ?> 
     <?php if(have_rows('the_commusoft_story')) { ?> 
     <?php $i = 0; ?> 
     <div class="tab-widget__tabs"> 
      <?php while(have_rows('the_commusoft_story')): the_row(); ?> 
      <?php $i++ ?> 
      <div class="tab-widget__tab-content"> 
      <h2 id="tab-panel-<?php echo $i; ?>"><?php the_sub_field('section_title'); ?></h2> 
      <?php the_sub_field('content'); ?> 
      </div> 
      <?php endwhile; ?> 
     </div> 
     <?php }; ?> 
    </div> 
    </div> 
</div> 

SOページ上の2つのセクションでは、私は2番目のセクションとしてそれを移動しようと、それが消えたときに問題が表示され、ある...

どれに何が起こっているかのアイデア、そして間違いはありますか?

ありがとうございました

+0

あなたはリンクを提供できますか? – user2517200

答えて

0

あなたのコードは間違いなく簡単にすることができます。余分なIF文を削除しました。必須ではありません。私はまた、$i++オペレータにライン終端を追加しました:

<div class="b b--alt"> 
    <div class="container"> 
     <div class="tab-widget tab-widget--team js-tab-widget"> 
      <?php if(have_rows('the_commusoft_story')) : ?> 
       <?php $i = 0; ?> 
       <ul class="tab-widget__list"> 
        <?php while(have_rows('the_commusoft_story')): the_row(); ?> 
         <?php 
         $i++; // This starts at 1. 
         ?> 

         <li class="tab-widget__item"> 
          <a href="#tab-panel-<?php echo $i; ?>" class="tab-widget__link"> 
           <span class="ss-icon <?php the_sub_field('icon'); ?>"></span> 
           <h2><?php the_sub_field('section_title'); ?></h2> 
           <?php the_sub_field('section_description'); ?> 
          </a> 
         </li> 

        <?php endwhile; ?> 
       </ul> 

       <?php $i = 0; ?> 
       <div class="tab-widget__tabs"> 
        <?php while(have_rows('the_commusoft_story')): the_row(); ?> 
         <?php 
         $i++; 
         ?> 
         <div class="tab-widget__tab-content"> 
          <h2 id="tab-panel-<?php echo $i; ?>"><?php the_sub_field('section_title'); ?></h2> 
          <?php the_sub_field('content'); ?> 
         </div> 
        <?php endwhile; ?> 
       </div> 

      <?php endif; ?> 
     </div> 
    </div> 
</div> 

これは、理論的には、コードの作業部分でなければなりません。だから私が書いたことがあなたのために働かないならば。私は、PHPのエラーをチェックするか、おそらくCSSスタイルの競合を調べることをお勧めします。

私たちはどのように乗り越えて投稿してください:)

関連する問題