Support

Account

Home Forums Add-ons Options Page Options Page Repeater breaking footer template

Solved

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! 😃

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.