Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to build a wp plugin, which will basically add some text for every post, in the post itself, I'm afraid that the codex is too large for me to even know what to look for, so I'd appreciate if someone could point me in the right direction.

Edit: As per request, the info should be added to the post's text on the database, at the end of the post, it's not static, it's a random embed from a tube site, based on a query I run on the tubesite.

share|improve this question
2  
Just a bit more guidance. Is it going to be the same text every time? If so it can be a simple template edit. Will the text be different? Will it go at the beginning, end, in the middle of the post? Does that vary? Do you want the text stored in the DB with the post, or just displayed to your reader? If you maybe update your question to be nice and specific, folks can offer some specific guidance for you –  Rev. Voodoo Aug 10 '11 at 13:24

1 Answer 1

up vote 1 down vote accepted

Your best bet is to use the the_content filter hook and add your content to the post "on the fly" for ex:

add_filter('the_content','add_my_extra_content');

function add_my_extra_content($content){
   $my_extra = "<h5>this is the extra content</h5>';

   //add before post content
   // return $my_extra.$content;

   //add after post content
   return $content.$my_extra.;

}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.