我需要自定义RSS文件,并且只需要显示来自post_content
把它放进去<img>
标记并删除任何单词,从post_content
.
那么,如何仅显示来自post_content
.
<?php foreach ($posts as $post) {
$content = get_the_content();
$postOutput = preg_replace(\'#<a[^>]+>([\\r\\n|\\n]+)?<img[^>]+>([\\r\\n|\\n]+)?<\\/a>#\',\'\', $post->post_content);
//$postContent = preg_replace("/<a[^>]+\\>/i", "", $postOutput);
?>
<article>
<id></id>
<title><?php echo get_the_title($post->ID); ?></title>
<link><?php echo get_permalink($post->ID); ?></link>
<abstract></abstract>
<body><?php echo \'<![CDATA[\'.$postOutput.\'<br/><br/>more: <a href="\'.get_permalink($post->ID).\'">\'.get_the_title($post->ID).\'</a>\'.\']]>\'; ?></body>
<date><?php yoast_rss_date( strtotime($post->post_date_gmt) ); ?></date>
<image_original>....</image_original>
<image_thumb>....</image_thumb>
<image_original_alt>....</image_original_alt>
<slideshow_images>
<image>
<image_url>.....</image_url>
<image_thumb_url>.....</image_thumb_url>
<image_alt>.....</image_alt>
</image>
<image>
<image_url>.....</image_url>
<image_thumb_url>.....</image_thumb_url>
<image_alt>.....</image_alt>
</image>
<image>
<image_url>.....</image_url>
<image_thumb_url>.....</image_thumb_url>
<image_alt>.....</image_alt>
</image>
</slideshow_images>
</article>
<?php } ?>