[wp-hackers] How To Append Content To A Post?

Eric Mann eric at eamann.com
Tue Sep 7 16:14:55 UTC 2010


Not with this filter.  See the codex reference here:
http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content
 
If you want both the content *and* the post ID, I recommend editing your loop to
append the content instead of using a filter.  Then you'll have access to all of
the post's meta information.


On September 7, 2010 at 4:11 PM Raj <list at expost.org> wrote:

> Is there anyway of passing the id of the post also?
>
> -----Original Message-----
> From: wp-hackers-bounces at lists.automattic.com
> [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Eric Mann
> Sent: Tuesday, September 07, 2010 8:43 PM
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] How To Append Content To A Post?
>
> All post content passes through the 'the_content' filter.  To append anything
> to post content merely requires that you hook into that filter and append your
> content.
> 
> For example, the following will append a paragraph element with body "this was
> appended":
> 
> function my_append_content($content) {
> $content = $content + "<p>This was appended</p>"; return $content; } 
>  add_filter('the_content', 'my_append_content');   On September 7, 2010 at
> 3:01 PM Raj <list at expost.org> wrote:
>
> >
> >
> > What is the proper method to append some content to a post. Suppose I
> > want to append a newsletter subscription form or an advertisement to
> > the end of all posts, what is the best method of doing this?
> >
> >
> >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list