Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

filter for some elements of the Feeds of a WP blog

By: a guest on Apr 1st, 2011  |  syntax: PHP  |  size: 0.89 KB  |  hits: 50  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /*
  3. Plugin Name: Feed Element Filter
  4. Plugin URI:
  5. Description: filters some of the Feed elements
  6. Author:
  7. Version: 1.0
  8. Author URI:
  9. */
  10.  
  11. add_filter('bloginfo_rss', 'pff_modify_bloginfo', 10, 2);
  12. function pff_modify_bloginfo($content, $feedelementname) {
  13.         // This filter can filter the Feed title, the URL and the description
  14.         Switch ($feedelementname) {
  15.                 case 'name' : // Feed title
  16.                         // If it is the feed with the slug 'podcast' replace the title as long as this plugin is active.
  17.                         // ( get_query_var('feed') can also be'feed' (RSS2), 'atom' (ATOM))
  18.                         if ( 'podcast' === get_query_var('feed') ) {
  19.                                 // The new Feed title:
  20.                                 return 'My Podcast';
  21.                         } else {
  22.                                 return $content;
  23.                         }
  24.                 break;
  25.                 case 'description' : // Feed description
  26.                         return $content;
  27.                 break;
  28.                 case 'url' : // Feed URL
  29.                         return $content;
  30.                 break;
  31.                 default :
  32.                         return $content;
  33.                 break;
  34.         }
  35. }
  36. ?>