1

I was fetching my blog posts from another WordPress site to another WordPress site. The issue I'm facing now is how to display the RSS Feed thumbnail.

See my code below.

<div class="row blog__container--row2">
   <?php
   $feed_url = 'https://www.alphawebtips.com/feed/';

   // Fetch the feed using SimplePie library
   require_once(ABSPATH . WPINC . '/feed.php');
   $rss = fetch_feed($feed_url);

   if (!is_wp_error($rss)) {
   // Set the number of posts to display
   $max_items = $rss->get_item_quantity(3);
   $rss_items = $rss->get_items(0, $max_items);
   }
   ?>

   <?php if ($max_items == 0) : ?>
   <div>No posts found.</div>
   <?php else : ?>
        <?php foreach ($rss_items as $item) : ?>
             <div class="col-lg-4">
                  <div class="blog__wrapper">
                       <div class="blog--single mb-3">
                            <h3><a href="<?php echo esc_url($item->get_permalink()); ?>" target="_blank"><?php echo esc_html($item->get_title()); ?></a></h3>
                            <a href="<?php echo esc_url($item->get_permalink()); ?>" target="_blank">Read More</a>
                       </div>
                  </div>

             </div>
        <?php endforeach; ?>
   <?php endif; ?>
   
</div>

What can I do to display the thumbnail? None of the WordPress functions/API works.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.