[wp-hackers] Re: RSS2 Action

Viper007Bond viper at viper007bond.com
Tue Apr 15 02:58:36 GMT 2008


Odd, that shouldn't work as is_feed() isn't defined when plugins are loaded
last I looked.

Try this code. And you shouldn't be echoing, you should be returning.


function addFeedAds( $content ) {
if ( !is_feed() ) return $content;

return $content . "\n\n My ads here";
}

add_filter( 'the_content', 'addFeedAds' );

On Mon, Apr 14, 2008 at 7:42 PM, Chris Poteet <cpoteet at siolon.com> wrote:

>
> > If you're trying to add to the post contents in feeds, just use the
> > "the_content" filter and abort if is_feed() returns false.
>
> Thanks Viper. I tried that, and it seems to work.
>
> function addAds() {
>   echo '<p>Content</p>';
> }
>
> if (is_feed())
>  add_action('the_content', 'addAds');
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/


More information about the wp-hackers mailing list