fgc-fixrss.php
770 Bytes
<?php
/*
Plugin Name: Fix image in RSS
Plugin URI: http://fgc.vn
Description: Fix image in RSS
Version: 1.0
Author: Fgc techlution - Ho Ngoc Hang
Author URI: http://fgc.vn
*/
/**
* fix and display thumbnail image of post in RSS
* @global type $post
* @param type $content
* @return type
*/
function fgcImageToRSS($content) {
global $post;
if (has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID, 'medium') . '</p>' . $content;
}
//” ″
//$content = preg_replace("/<img[^>]+\>/i", "", $content);
$content = preg_replace("/<img[^>]+\>/i", "", $content);
return $content;
}
add_filter('the_excerpt_rss', 'fgcImageToRSS');
add_filter('the_content_feed', 'fgcImageToRSS');