How to modify a specific RSS feed, without affecting others?
-
Hi all
I have a site with 2 separate feeds – one for the main blog, and the other for a custom post type:
Blog Posts feed – [WEBSITE URL]/feed
CPT feed – [WEBSITE URL]/feed/?post_type=podcastsIn order for the podcasts feed to validate in iTunes, I append a direct link to the MP3 file using the following code:
function mtg_podcast_include($content) {// Including the podcast link in the podcast RSS feed global $wp_query; $postid = $wp_query->post->ID; $mtg_podcast_url = get_field('mtg_podcast_file_url'); if(is_feed()) { if($mtg_podcast_url !== '') { $content = $content.'<a href="'.$mtg_podcast_url.'" rel="enclosure">Download MP3</a>'; } else { $content = $content; } } return $content; } add_filter('the_excerpt_rss', 'mtg_podcast_include'); add_filter('the_content', 'mtg_podcast_include');
The problem is, a download link is also appearing at the end of each post in the blog posts feed. Can anyone tell me how I go about modifying only the podcasts feed?
Any help is appreciated!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to modify a specific RSS feed, without affecting others?’ is closed to new replies.