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:
The final code looks something like this:
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:
- Look for the wp-includes/feed-rss2.php and wp-includes/feed-rss.php scripts in your Wordpress folder
- 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>"
- 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>
global $more;
$more = false;
?>
<content:encoded><![CDATA[<?php the_content('Read More...'); ?>]]></content:encoded>