Brandon Powell Brandon Powell - 2 months ago 19
CSS Question

ACF Error Message

I'm working on my first WordPress theme and working with advanced custom fields to make a services section on the homepage.

The custom fields that him using is the Repeater field, Text field, Textarea field and Image field.

I setting up everything inside my content-services.php file but when I load the WordPress Site I get an error message saying that

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>


Here a diagram what I'm trying to create on my browser.

enter image description here

Answer

You have got 3x'if' and 4x'endif'. Change:
endwhile; endif; // End of the Loop.
to:
endwhile; // End of the Loop.