Home › Forums › Add-ons › Options Page › Options Page Repeater breaking footer template
Using the new Options page creator in ACF PRO, I created an options page and named it Footer. I created a repeater for social icons and added the following code to the footer template:
<div class="social_icons">
<?php
if( have_rows('social_icons', 'option') ):
while ( have_rows('social_icons', 'option') ) : the_row(); ?>
" title="<?php the_sub_field('name'); ?>"> <?php the_sub_field('font_awesome_code'); ?>
<?ph endwhile;
else :
endif;
?>
</div><!-- .social_icons -->
This code breaks the footer. Can someone please help me get to the bottom of this?
<div class="social_icons">
<?php
if( have_rows('social_icons', 'option') ):
while ( have_rows('social_icons', 'option') ) : the_row(); ?>
<a href="<?php the_sub_field('link'); ?>" title="<?php the_sub_field('name'); ?>"> <?php the_sub_field('font_awesome_code'); ?> </a>
<?ph endwhile;
else :
endif;
?>
</div><!-- .social_icons -->
Nevermind… Just before the elsewhile I had <?ph instead of <?php
My bad. This code now works
Hey Trishah,
It looks like there’s a small syntax error in your PHP code. The issue is likely coming from this part:
<?ph endwhile;
It should be:
<?php endwhile; ?>
Also, for better debugging, try this corrected version of your code:
<?php if (have_rows(‘social_icons’, ‘option’)) : ?>
<div class=”social_icons”>
<?php while (have_rows(‘social_icons’, ‘option’)) : the_row(); ?>
” title=”<?php the_sub_field(‘name’); ?>”>
<?php the_sub_field(‘font_awesome_code’); ?>
<?php endwhile; ?>
</div><!– .social_icons –>
<?php endif; ?>
This should prevent errors and ensure the loop runs properly.
Glad you caught that! It’s crazy how a small typo can break everything. This actually reminds me of business setup—one tiny mistake in legal paperwork or licensing can cause big delays. Just like debugging code, double-checking everything is key! 😃
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.