I am trying to use a custom rss templet that will display the featured image as well as the author. I would like to have the media:content tag around the image was well. I have tried using a templet https://yoast.com/custom-rss-feeds-wordpress/ it works for the rss feed but will not show images or the author.

Template Name: Custom Feed

$numposts = 10;

function acustom_rss_date( $timestamp = null ) {
$timestamp = ($timestamp==null) ? time() : $timestamp;
echo date(DATE_RSS, $timestamp);

function acustom_rss_text_limit($string, $length, $replacer = '...') { 
$string = strip_tags($string);
if(strlen($string) > $length) 
return (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches)          ?   $matches[1] : substr($string, 0, $length)) . $replacer;   
return $string; 

$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">
<title>Test E-mail Update</title>
<description>The latest posts from test.com</description>
<pubDate><?php acustom_rss_date( strtotime($ps[$lastpost]->post_date_gmt) );  ?>  </pubDate>
<lastBuildDate><?php acustom_rss_date( strtotime($ps[$lastpost]- >post_date_gmt) ); ?></lastBuildDate>
<?php foreach ($posts as $post) { ?>
<title><?php echo get_the_title($post->ID); ?></title>
<link><?php echo get_permalink($post->ID); ?></link>
<description><?php echo '<![CDATA['.acustom_rss_text_limit($post- >post_content, 500).'<br/><br/><a href="'.get_permalink($post->ID).'"> Continue Reading. </a>'.']]>';  ?></description>
<pubDate><?php acustom_rss_date( strtotime($post->post_date_gmt) ); ?></pubDate>
<guid><?php echo get_permalink($post->ID); ?></guid>
<?php } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.