Advertisement
Guest User

filter for some elements of the Feeds of a WP blog

a guest
Apr 1st, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  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. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement