Howard Ha
  • Blog
  • About
  • Business Opportunities
  • Contact

Getting the Wordpress "read more" link to work in RSS feeds

8/10/2010

1 Comment

 
Sometime in 2008, around Wordpress 2.6 or so, the Wordpress team made an update to "fix" a bug with how "Read More" works in the RSS feeds.  Apparently the "Read More" feature was not intended to work in RSS feeds when you chose to show full posts in feeds (Settings > Reading > For each article in a feed, show > Full text).  Some users seemed to really like this "fix" but for TalkAndroid it was a nuissance because sites were using our RSS feed to reproduce our entire content on their own pages and the "Read More" tag was useful for splitting up our more original content.


After many hours of tooling around I found a reference to Customizing Read More and this handy post here which mentions enabling the "Read More" on pages aside from the main page of your blog.  Even those two pages were not enough.  I had to track down exactly where the RSS pages were and then hack them specifically to make it work.  Here's how to do it:

  1. Look for the wp-includes/feed-rss2.php and wp-includes/feed-rss.php scripts in your Wordpress folder
  2. Look for code that looks like "<content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>" and replace it with: "<content:encoded><![CDATA[<?php the_content('<strong>Read More...</strong>'); ?>]]></content:encoded>"
  3. Add <?php $more = false; ?> right before the content encode portion of the RSS files.  This part is necessary because the the_post() function sets $more to 1 and this prevents the Read More from working.

The final code looks something like this:
<?php
global $more;
$more = false;
?>
<content:encoded><![CDATA[<?php the_content('Read More...'); ?>]]></content:encoded>
1 Comment

    About Me

    I'm a web entrepreneur based out of Vancouver, BC, Canada.

    I have a passion for technology, web scalability, gaming, life, reading, and many other things.

    I believe in good, trust, enjoying the little things, and the pursuit of perfection.

    Archives

    February 2012
    December 2010
    October 2010
    September 2010
    August 2010
    July 2010
    June 2010

    Categories

    All
    Admanager
    Captcha
    Doubleclick
    Facebook
    Google
    Ipb
    Musings
    Mysql
    Openx
    Real Estate
    Rss
    Social Networks
    Star Wars
    Talkandroid
    Twitter
    Twitterfeed
    Videos
    Wordpress



    Follow Me:
    • Facebook
    • Twitter
    • darkcobalt (Neoseeker related tweets)
    • RSS Feeds


    My Sites:
    • Neoseeker
    • OverclockersClub
    • StrategyWiki.org
    • TalkAndroid
    • AndroidForum.com
    • USAudioMart
    • GameGrep


    Other pages:
    • LinkedIn
    • My Flickr Pics
    www.flickr.com
    howardhaGo to howardha's photostream
Powered by Create your own unique website with customizable templates.