WordPress.org

Ready to get started?Download WordPress

Forums

RSS widget and Google reader shared items (9 posts)

  1. bowa
    Member
    Posted 6 years ago #

    when using a google reader shared items rss feed with the RSS widget, the links are not working (the hostname is appended to the url for some reason) and the link on the title of the widget has an a-tag but the href is not filled it, so i guess it would be better to just drop the anchor tag when there is nothing to link to.

  2. eleventy
    Member
    Posted 6 years ago #

    I'm seeing this behavior as well (v2.5).

  3. TonyH
    Member
    Posted 6 years ago #

    I am also having issues since updating to 2.5. I have not had a link since 3/26/08. My blogsearch google Yet links are showing up at Technorati Any help would be appreciated.

    My site is Skate 2 Stick I am using wordpress version 2.5

  4. karlkatzke
    Member
    Posted 6 years ago #

    Funny, I just spent about six hours hacking my way around this problem.

    The problem is mainly with MagpieRSS, which assumes you'd like to append all elements of a certain type to one another instead of maintaining them as separate elements -- and to add insult to injury, appends all elements in subelements to one another. WordPress uses MagpieRSS to parse RSS feeds, even though there's a dozen or so more modern libraries that they could've used that actually, you know, work.

    Hey, I've got a brilliant idea, let's code like it's 2000 and PHP4 just came out! No one uses this 'multiple layer' feature of XML! Whoever made the decision to use this library at automattic should be taken out back of the building and shot.

    Fantasies of revenge aside, here's a description of the problem.

    Given a sample ATOM feed:

    <entry>
      <title>Foo, the foo of foos!</title>
      <source>
        <title>Foobar</title>
      </source>
     </entry>

    Note: <a href="http://www.google.com/reader/public/atom/user/17079902422104787188/state/com.google/broadcast
    ">My actual google feed

    ... Magpie collapses the title field in Atom based on it's configuration, so you'll end up with your item title being 'Foo, the foo of foos!Foobar'.

    That's easy to fix. Go into wp-includes/rss.php, and change the CONTENT_CONSTRUCTS array... remove title from the array. You'll end up with two different titles -- $item['title'] and $item['source_title']. Gee, that's intelligent.

    The links are a little harder to fix, because it does the same thing but through a different stupid hack. I honestly got tired of messing with a stupid hack and just made my own stupid hack to get around it. In rss.php, you'll find these lines:

    elseif ($this->feed_type == ATOM and $el == 'link' )
            {
                if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
                {
                    $link_el = 'link';
                }
                else {
                    $link_el = 'link_' . $attrs['rel'];
                }
    
                $this->append($link_el, $attrs['href']);
            }

    That's what we call a bad idea, mkay, kids? Don't assume there's only one 'link' element.

    The worse idea that I used to get around the bad idea is to add this to widgets.php inside the wp_widget_rss_output function (note the plusses):

    foreach ($rss->items as $item ) {
                 while ( strstr($item['link'], 'http') != $item['link'] ) {
                     $item['link'] = substr($item['link'], 1);
                 }
    +            if($secondhttp = strpos($item['link'],'http',5)) {
    +                $item['link'] = substr($item['link'],0,$secondhttp);
    +            }
                 $link = clean_url(strip_tags($item['link']));

    ... mine now works. Yes, I realize that this hacks up the base code, but I wasn't going to spend a full day with the retarded plugin API making my own.

    I'd post cleaner code, but I'm too pissed off at the egregious waste of the last four hours or so. Gonna go rub the puppy's tummy.

  5. karlkatzke
    Member
    Posted 6 years ago #

    (Apparently the "allowed markup" isn't working when you edit a post. <a href="http://www.google.com/reader/public/atom/user/17079902422104787188/state/com.google/broadcast
    ">My google feed.)

    WordPress 2.5 - Full of win!

  6. pabloalvestegui
    Member
    Posted 5 years ago #

    I have the same problem but I don't know how to do what karlkatzke says...

    There has to be an easier way to do it... maybe another plugin?

    PLEASE HELP

  7. EliezerIsrael
    Member
    Posted 5 years ago #

    Put together a way to solve this one. You can basically polish the feed beforehand using FeedBurner.
    Details at: http://sowinglight.com/2008/11/showing-google-reader-feeds-on-a-wordpress-sidebar/

  8. philgreen
    Member
    Posted 5 years ago #

    Karlkatzke I did what you said and the links work but the titles don't:

    veryserious.org (rss widget is on the lower left hand side)

    Line 47 of rss.php is:

    var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'tagline', 'copyright');

  9. philgreen
    Member
    Posted 5 years ago #

    Never mind, now it works. I guess it just needed a minute.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags