Support

Account

Home Forums Add-ons Repeater Field Repeater Field w/ WYSIWYG in RSS Feed

Solved

Repeater Field w/ WYSIWYG in RSS Feed

  • 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.

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

The topic ‘Repeater Field w/ WYSIWYG in RSS Feed’ is closed to new replies.