Forum Replies Created

Viewing 2 replies - 31 through 32 (of 32 total)
  • You need to define $postid so the function knows where the posts are to pull custom fields from them. Add the following code above the $customimage = XXX line and it should work (though it did take some time for RSS to refresh for me):

    global $wp_query;
    $postid = $wp_query->post->ID;

    You can use filters in your functions.php file in your theme directory to add content into the RSS feed. Here’s some sample code I was using on a site to add a description, video embed, and show notes to the feed which were all custom fields:

    function wpbeginner_postrss($content) {
    global $wp_query;
    $postid = $wp_query->post->ID;
    $description = get_post_meta($postid, 'Description', true);
    $video = get_post_meta($postid, 'Video Embed Code', true);
    $shownotes = get_post_meta($postid, 'Show Notes', true);
    if(is_feed()) {
    if($description !== '') {
    $content = $description . " " . $video . "<h2>Show Notes</h2>" . $shownotes;
    }
    else {
    $content = $content;
    }
    }
    return $content;
    }
    add_filter('the_excerpt_rss', 'wpbeginner_postrss');
    add_filter('the_content', 'wpbeginner_postrss');
Viewing 2 replies - 31 through 32 (of 32 total)