Home › Forums › General Issues › Basic PHP question › Reply To: Basic PHP question
On the off chance that someone else may be looking for this, here’s my solution.
It checks whether the field exists, then outputs 10 RSS feed items including title and full content.
<?php $blogfeed = get_post_meta($post->ID, ‘blog_feed’, true);
if($blogfeed) : ?>
<?php
include_once(ABSPATH.WPINC.’/rss.php’); // path to include script
$feed = fetch_rss($blogfeed); // specify feed url
$items = array_slice($feed->items, 0, 10); // specify first and last item
?>
<?php if (!empty($items)) : ?>
<?php foreach ($items as $item) : ?>
<div class=”feed-item”>
<h4>” target=”_blank”><?php echo $item['title']; ?></h4>
<p><?php echo $item['atom_content']; ?></p>
</div>
<?php endforeach; ?>
<?php endif; ?>
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.