ACF错误消息

时间:2016-09-17 21:02:00

标签: php html css wordpress

我正在处理我的第一个WordPress主题,并使用高级自定义字段在主页上创建服务部分。

他使用的自定义字段是Repeater字段,Text字段,Textarea字段和Image字段。

我在content-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

1 个答案:

答案 0 :(得分:2)

你有3x'if'和4x'endif'。 变化:
endwhile; endif; // End of the Loop.
于:
endwhile; // End of the Loop.