Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am building a WP website where the client uses Blogger to manage their blog for their business (they have no intent on switching to WP to blog, don't ask me why, ugh). The code below works great for many other blogs, including the jQuery blog, WP Tuts+, and my personal blog.

However, I cannot get any Blogger blog feeds to display. I can grab the feed in Google Reader just fine and the feeds are all valid, per feedvalidator.org. Anyone have any thoughts as to why I can't grab Blogger feeds? Thanks.

 <?php if(function_exists('fetch_feed')) {
    $feed = fetch_feed('http://printsourceva.blogspot.com/feeds/posts/default?alt=rss');

    $limit = $feed->get_item_quantity(1);
    $items = $feed->get_items(0, $limit);

    if($limit == 0) echo '<div>The feed is either empty or unavailable.</div>';

    else foreach ($items as $item) : ?>

    <p><?php echo substr($item->get_description(),0, 200); ?> </p>

    <a href='<?php echo esc_url( $item->get_permalink() ); ?>' 
    title='<?php echo esc_html( $item->get_title() ); ?>'>
    Read more
    </a>

    <?php endforeach; ?>

EDIT: So my problem was that the images are loaded at the top of the post and were loading rather than the text. D'oh. Is there an easy way to just parse out the images from the feed?

share|improve this question
I tried this and the feed loaded fine? It only retrieved one item, though. Where is this failing on your site? – weberwithoneb Jun 4 '12 at 20:43
I'm adding it to sidebar.php. – Stevie Jun 4 '12 at 21:10
I mean, after what line is the above code segment failing? :) – weberwithoneb Jun 4 '12 at 21:13
I realized that the above code was working fine with EAManns' suggestions from below. The image codes from the feed were showing up first and therefore not displaying the text content that I was expecting. Womp womp, dumb mistake. Now I am left figuring out how to get rid of the images and just displaying text. – Stevie Jun 4 '12 at 21:23

closed as too localized by Rarst Sep 2 '12 at 6:11

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

Assuming this is the actual code you're using, you have a typo:

$feed = fetch_feed('http://printsourceva.blogspot.com/feeds/posts/default?alt=rss"');

Should be

$feed = fetch_feed('http://printsourceva.blogspot.com/feeds/posts/default?alt=rss');

You have an extra " at the end of the RSS feed URL. If you request this actual URL (http://printsourceva.blogspot.com/feeds/posts/default?alt=rss") you get a 400 Bad Request response from the server.

share|improve this answer
Made the change (thanks for spotting it), but still having no luck with the feed loading. – Stevie Jun 4 '12 at 20:34

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