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

Eric Mann eric at eamann.com
Tue Sep 7 15:13:22 UTC 2010


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


More information about the wp-hackers mailing list