0

I am pulling in posts from separate WP installs on separate URLs. I have everything I want except for the thumbnail. My theme supports thumbnails but when I ask for the thumbnail it is showing me NULL. Anyone know why this may be happening? When I var_dump($item) it shows NULL for my thumbnails. All my posts on that sep. URL do have a featured image.

functions.php

add_theme_support( 'post-thumbnails' );

The RSS Page

<?php
  include_once(ABSPATH . WPINC . '/feed.php');
  $rss = fetch_feed(PATH_TO_MY_URL);
  if(!empty($rss)):
    $maxitems = $rss->get_item_quantity(4);
    $rss_items = $rss->get_items(0, $maxitems);
  endif;
?>

<?php
      if ($maxitems == 0) :
        echo 'No News.';
      else :
        foreach ( $rss_items as $item ) : ?>

          <div class="post-block">
            <figure>
              <a href="#">
                <?php
                  if ($enclosure = $item->get_enclosure()) :
                        echo $enclosure->get_thumbnail();
                    endif;
                ?>
              </a>
            </figure>
            <h3 class="mbs"><a target="_blank" href="<?php echo $item->get_permalink(); ?>" class="link-color-1"><?php echo $item->get_title(); ?></a></h3>
            <?php echo $item->get_description(); ?>
            <a target="_blank" href="<?php echo $item->get_permalink(); ?>" class="btn mtxs btn-sm btn-color-3">Read Full Article &nbsp;<i class="fa fa-angle-double-right"></i></a>
          </div>

        <?php endforeach; ?>
      <?php endif; ?>
0

I don't remember WP feeds to have any care for thumbnails feature. There is some handling for enclosure meta (seems dusty, don't even remember what that is), but from quick test it seems to ignore thumbnails.

Why do you expect exactly for thumbnails to just appear in feed?

Unless I am missing something, it seems you would need to hook in and add thumbnail information to the feed yourself.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.