2016-09-17 8 views
0

私は最初のWordPressテーマで作業しており、高度なカスタムフィールドを使用してホームページにサービスセクションを作成しています。ACFエラーメッセージ

彼が使用するカスタムフィールドは、Repeaterフィールド、Textフィールド、Textareaフィールド、およびImageフィールドです。

私は私のコンテンツservices.phpファイル内のすべてのものを設定するが、私はWordPressサイトをロードするとき、私はここでParse error: syntax error, unexpected 'endif' (T_ENDIF), expecting end of file in/Users/brandonpowell/sites/valet/pixelcitytheme/web/app/themes/pixelcitytheme/templates/partials/content-services.php on line 46

<section class="services cf"> 
<div class="wrapper"> 
<?php // Start the loop 
while (have_posts()) : the_post(); ?> 
<?php if (the_rows('services_sections')): 
while (have_rows('services_sections')): the_row(); ?> 
<div class="service"> 
<div class="box-service"> 
<div class="pull-left"> 
<?php 
$image = get_sub_field('services_icon'); 
if(!empty($image)): ?> 
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> 
<?php endif; ?> 
</div> 
<div class="right-word"> 
<h3><?php the_sub_field('service_title') ?></h3> 
<p><?php the_sub_field('services_description')?></p> 
</div> 
</div> 
<div class="line"></div> 
<div class="box-service"> 
<div class="pull-left"> 
<?php 
$image = get_sub_field('services_icon'); 
if(!empty($image)): ?> 
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> 
<?php endif; ?> 
</div> 
<div class="right-word"> 
<h3><?php the_sub_field('service_title') ?></h3> 
<p><?php the_sub_field('services_description')?></p> 
</div> 
</div> 
</div> 
<?php endwhile; ?> 
<?php endif; ?> 
<?php endwhile; endif; // End of the Loop. ?> 
</div> 
</section> 

ことを、私は私の上で作成しようとしていますどのような図をというエラーメッセージが表示されますブラウザ。

enter image description here

+0

プログラミングの一般的なルールとして:あなたが適切にあなたのコードをインデントする場合は、非常に迅速に自分で問題を見るでしょう。 –

答えて

2

あなたは3x'if 'と4x'endif' 持っています。 変更:
endwhile; endif; // End of the Loop.
へ:
endwhile; // End of the Loop.

+0

こんにちは@TomaszWinter助けてくれてありがとうそれは動作しますが、コンテンツはサイトにロードされています。 –

+0

コンテンツに何が問題がありますか?他のエラーはありますか? –

+0

私は他のエラーはありません。しかし、コンテンツは私のWordPressのダッシュボードの中に私のサービスのカスタムポストタイプがページにロードされていないことを理解することを追加します。 –