2016-09-17 152 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儀表板內添加的內容瞭解我的服務自定義帖子類型沒有加載在頁面上。 –