WordPress: How to feed RSS with contents from another table (not wp_posts)
If you want to make RSS to use data from another table, you need to edit the_excerpt_rss() function in wp-includes/feed.php file, change
$output = get_the_excerpt(true);
to something like this:
function the_excerpt_rss() {
// $output = get_the_excerpt(true);
global $wpdb, $post;
$postID = $post->ID;
$grants = $wpdb->get_results(”select abstract
from grants where post_id= $postID”);
$output=”";
foreach ($grants as $grant)
{
$output=$grant->abstract;
}
echo apply_filters('the_excerpt_rss', $output);
}
Or (the best way), write your own function like this:
function the_abstract_rss() {
global $wpdb, $post;
$postID = $post->ID;
$grants = $wpdb->get_results(”select abstract
from grants where post_id= $postID”);
$abs=”";
foreach ($grants as $grant)
{
$abs=$grant->abstract;
}
echo $abs;
}
then apply filter:
add_filter('the_excerpt_rss','the_abstract_rss');
Popularity: 1%


















































