tags:

views:

21

answers:

1

This may be a weird or stupid question, but I have the following code (http://pastebin.com/PTFtqkvs) and I want to place a simple "read more" link after the description which links to the the article in the rSS feed - however whatever I do isn't working. Is it even possible to add this option and still conform to the rSS guidelines? This is built using a WP system to show Posts in a certain category.

Any help would be greatly appreciated.

+1  A: 

You can hook onto feed specific hooks to add that to your feed content. Something like this in your theme's functions.php would work:

function my_super_awesome_feed_linker( $content ){
  $extra = "<a href='" . get_permalink() . "'>Read More...</a>";
  return $content . $extra;
}

add_filter( 'the_excerpt_rss', 'my_super_awesome_feed_linker' );

This will add a 'read more' link to all your feeds, though.

In order for this to work, you need to use a normal WordPress loop and the function the_excerpt_rss() instead of what you do in your code, echo $post->post_excerpt;. I've modified your pastebin here:

http://pastebin.com/6Y8pewhW

Also, just a word of advice, this won't really work as a template. WordPress has already sent headers by the time you've gotten to the page's template file. So you'll need to find a way to get those headers sent correctly, or to override them. The two easiest ways would be to filter the header content or to query the posts at 'wp_loaded' before headers are sent.

John P Bloch
this code doesn't work, it doesn't even display the rss feed contents (http://dev.liquor.com/custom-rss-feed/)
HollerTrain
Because, as I warned you in the end of my answer, WordPress is setting the header to html, not xml. My solution works if you're properly implementing the feed in the first place.
John P Bloch