2
votes

In some of my posts (category: music) the only content is a youtube video. Unfortunately, not all rss readers display the video. That's why, in the feed for this category, i would like to replace the content (the video) with some text, for example "Visit our page to watch the video".

I believe there are three approaches to my problem:

1) customize the feed template (wp-includes\feed-rss2.php). I don't want to edit core files, so that is not for me.

2) create a new template (described here) and customize it. This works fine for my main feed (mysite.com/feed/customfeed/) but won't work for the category feed (mysite.com/music/feed/customfeed/). Any ideas why?

3) use a filter. I have no idea (and no programming skills) how to make this work. I imagine something like this: if is feed from category 3 remove filter the_content and add text "Visit our page..." Is this possible? Is this a good idea?

Any help will be much appreciated.

2

2 Answers

2
votes

you shouldn't modify feed-rss2.php. but if you really want to then add the following before the loop (add a row after row 33)

<?php query_posts('cat=-55'); ?>
1
votes

One way is go to your setting> reading.. change the "for each article in the feed show". choose summary, then on your music pages, write a sentence or two before the video, that way this will show up first on your feed. another is to totally exclude music category from your feeds like this:

function exclude_category($query) {
    if (is_feed()) {
    $query->set('cat', '-6'); //6 depends on category of your music. its minus to exclude
    }   
return $query;
}

*p.s. just add the following code in your functions.php