Insert custom content after each post

For some reason, you may want to be able to automatically display a custom text below each of your posts. You can hard-code it, but it will be way better to do so using a WordPress hook. Here’s how to do.

You just have to paste the following code into your functions.php and save the file. Once done, custom content will be inserted below each of your posts.

function add_post_content($content) {
	if(!is_feed() && !is_home()) {
		$content .= '<p>This article is copyright &copy; '.date('Y').'&nbsp;'.bloginfo('name').'</p>';
	}
	return $content;
}
add_filter('the_content', 'add_post_content');

Leave a Reply

Your email address will not be published. Required fields are marked *