- b2evolution CMS User Manual
- Advanced Topics
- How to...
- Show images in my RSS when option "Post excerpts" is selected
Show images in my RSS when option "Post excerpts" is selected
By default, when you set the RSS mode of your blog as Post excerpts RSS/Atom Feeds, and due the post excerpts are composed exclusively with text, your images will not be linked in the final XML file. In order to include your images set as teaser, you will need to make a little code customization as following:
Locate the file /blogs/skins/_rss2/index.main.php
and look for this line
$content = $Item->get_excerpt();
Note: If you are using version 5.0.6, and have not touched this file before, it should be the line number 127.
Replace that line with this code:
// Display images that are linked to this post:
$content = $Item->get_images( array(
'before' => '<div>',
'before_image' => '<div>',
'before_image_legend' => '<div><i>',
'after_image_legend' => '</i></div>',
'after_image' => '</div>',
'after' => '</div>',
'image_size' => $image_size,
'restrict_to_image_position' => 'teaser' //this line defines which image types will be included in the output
), 'htmlbody' );
$content .= $Item->get_excerpt();
After that, your RSS output will look like in the image: