Including text at the end of every post

You can try the the_content filter, to append/prepend text to the post content.

Here’s a simple example:

add_filter( 'the_content', function( $content ) {

    if( is_single() && has_tag( 'follow-me-on-twitter' ) )
    {
        $content .= '<div>Like my posts? Follow me on twitter!</div>';
    }
    return $content;

}, 99 );

where we append the extra text if the current single post has the follow-me-on-twitter tag.

Other ideas:

  • You can do something similar for categories with the has_category() function.

  • You might consider adding an extra taxonomy to your posts, that’s not visible on your site, to handle the markings. Then you need has_term() instead.

  • You can use the post meta (custom fields) to mark each post. Maybe add a meta box with a select box.