Custom RSS with the_excerpt
-
I have a custom RSS feed with the following code snippet:
<description><?php echo '<![CDATA['.'<p><span>by </span><strong>'.get_post_meta($post->ID,'author',true).'</strong></p><br>'.the_excerpt_rss($post->ID).'<a href="'.get_permalink($post->ID).'">Read the rest of this story.</a><br><br><br>'.']]>'; ?></description>
Is that the proper use of the_excerpt? This doesn’t work for some reason.
Here is the complete file:
<?php /* Template Name: Custom Feed */ $numposts = 7; function ffm_rss_date( $timestamp = null ) { $timestamp = ($timestamp==null) ? time() : $timestamp; echo date(DATE_RSS, $timestamp); } $posts = query_posts('showposts='.$numposts); $lastpost = $numposts - 1; header("Content-Type: application/rss+xml; charset=UTF-8"); echo '<?xml version="1.0"?>'; ?><rss version="2.0" xmlns:atom="https://www.w3.org/2005/Atom"> <channel> <title>Website</title> <link>https://website.org/</link> <atom:link href="https://website.org/feed/ac" rel="self" type="application/rss+xml" /> <description>The latest stories from Website</description> <language>en-us</language> <lastBuildDate><?php ffm_rss_date( strtotime($ps[$lastpost]->post_date_gmt) ); ?></lastBuildDate> <managingEditor>[email protected] (My name)</managingEditor> <item> <title><?php echo get_the_title($post->ID); ?></title> <link><?php echo get_permalink($post->ID); ?></link> <pubDate><?php ffm_rss_date( strtotime($ps[$lastpost]->post_date_gmt) ); ?></pubDate> <description><?php echo '<![CDATA['.'<p><span>by </span><strong>'.get_post_meta($post->ID,'author',true).'</strong></p><br>'.the_excerpt_rss($post->ID).'<a href="'.get_permalink($post->ID).'">Read the rest of this story.</a><br><br><br>'.']]>'; ?></description> <guid><?php echo get_permalink($post->ID); ?></guid> </item> <?php } ?> </channel> </rss>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom RSS with the_excerpt’ is closed to new replies.