Support

Account

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; ?>