Support

Account

Forum Replies Created

  • Of course this is what the structure looks like:

    => Repeater
    ==> Group
    ===> Repeater
    ====> Text [has whitespace issues]

  • Before you ask, just to name a few of the things I’ve tried:

    Trimmed any whitespace from fields before output.

    Replaced non-breaking with regular spaces.

    Collapsed multiple spaces into a single space.

    Removed control or invisible characters like zero-width spaces.

    Cleared extra spaces between tags using regex.

    But the issue remains and the root cause seems to be lying deeper within ACF. I also don’t think all these steps should be necessary in order to output clean text.

  • I’m having the same issue.

    In my case this is only happening with nested repeaters/groups, specifically:

    – Repeater
    – Group
    – Repeater
    – Text [has whitespace issues]

    In other cases with the same setup, this isn’t happening, e.g,:

    – Repeater
    – Text [no issues here]

    Any updates on this? I have tried for several days now, did lots of research, double-checked the source, looked for copy & paste errors, tried to sanitize this in every way you could possibly think of, but nothing can seem to fix it.

    First of all, the #Text nodes aren’t being wrapped inside their parent element correctly, which I’ve seen before, and which might even be common. I was able to fix that, however, there are still spaces around the actual text–a regular leading whitespace and a non-breaking trailing whitespace.

    Example:

    <a href=""> Hello There </a>

    Before the fix it was actually not even wrapped and looked like this:

    <a href=""></a>
               Hello There          

    I’m fairly certain everything is set up correctly and that the source material is clean too. Also, everything is working fine elsewhere. This is only happening when repeaters/groups are nested (twice?). Is there something that I am missing? Are there any known solution to this?

    Thanks much.

  • To be clear: I’m not referring to the CPT slug which is fine. I need to change the slug of the individual post.

  • The simplified PHP to get a better idea:

    <?php
    
    function acf_repeater_shortcode() {
    
    	ob_start();
    
    	if (have_rows('Table')) : ?>
    
    <table class="Table">
    
    	<tr>
    		<th class="Country">Chart</th>
    		<th class="Points">Position</th>
    	</tr>
    
    	<?php while (have_rows('Table')) : the_row(); ?>
    
    	<tr>
    		<td class="Country"><?php the_sub_field('Country'); ?></td>
    		<td class="Points"><?php the_sub_field('Points'); ?></td>
    	</tr>
    
    	<?php endwhile; ?>
    
    </table>
    
    <?php endif; ?>
    
    <?php return ob_get_clean();
    
    }
    
    add_shortcode('Table', 'acf_repeater_shortcode');
Viewing 6 posts - 1 through 6 (of 6 total)