write in functions.php

I’m not sure why you don’t just insert the code in the single.php, or use Denis’s solution, but if you want to hook into the_content you can do so by putting the following in your functions.php file:

function append_the_content($content) {
    $content .= 'PUT YOUR FUNCTION HERE';
       return $content;
}
add_filter('the_content', 'append_the_content');

This will add directly to the end of the_content.

You can call your Twitter function above this and it should work. You’d be better off using a theme framework with some custom hooks because hooking into the_content in this way can get very buggy very fast depending on what other filters/hooks your theme and plugins are using to modify the_content. I don’t know why it happens, I just know that it does.

Leave a Comment