Adding identical text to the end of every WordPress post

Ever wonder how to programmatically add identical text to the end of every one of your WordPress posts? For example, a Google Adsense script or some social-sharing buttons? Try adding this to your functions.php file:

1
2
3
4
5
6
7
add_filter('the_content', 'add_some_text');
 
function add_some_text($content){
     global $post;
     $content = $content . 'TEXT TO ADD HERE';
     return $content;
}
This entry was posted in wordpress and tagged , . Bookmark the permalink. Both comments and trackbacks are currently closed.
  • Categories

  • Archives