I have a repeater field (step) that contains a WYSIWYG in each repeater (steps) that I’m trying to output in a custom RSS feed. The issue that I’m running into is that when I add the call to the repeater into the RSS template, I get nothing on output:
<?php $steps = get_field('step'); ?>
<?php if($steps) { ?>
<p><strong>Directions: </strong></p>
<div>
<?php foreach($steps as $step) { ?>
<p><?php echo $step['add_step'] ?></p>
<?php } ?>
</div>
<?php } ?>
If I run it trough feed validator, then seems to be breaking on the “br” tag in the wysiwyg field. I’m assuming I need to strip them out, but I’m not sure how.
Error from feed validator:
<b>Parse error</b>: syntax error, unexpected T_VARIABLE in <b>/home/annie/public_html/wp-content/themes/annies-eats/feed-rss2.php</b> on line <b>90</b><br />
Any help would be appreciated.
Hi Joe,
You could try this to strip out all HTML tags. Might be good to do this for RSS:
<?php $steps = get_field(‘step’); ?>
<?php if($steps) { ?>
<p>Directions: </p>
<div>
<?php foreach($steps as $step) { ?>
<p><?php echo strip_tags($step[‘add_step’]); ?></p>
<?php } ?>
</div>
<?php } ?>
Here’s the documentation: http://php.net/manual/en/function.strip-tags.php
Hi @Joe
Looks like you are missing a semicolon in your code.