How to add content after each post – WordPress

Do you want to add content after all the posts on your site?

With this easy snippet you could add the Twitter button or Facebook like to all posts without messing with the theme.

I've used it here in CodeGround to add the share buttons after each post.


Paste the following code at the end of your functions.php file of your theme.

You could remove the !is_feed() or !is_home() conditions in case you wanted it to appear in the feed and homepage.

function add_content_after($content) {
	if(!is_feed() && !is_home()) {
		$content .= '<p>Share the post!</p>';
	return $content;
add_filter('the_content', 'add_content_after');

About Ricard Torres

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

Leave a Reply

Add <code> Some Code </code> by using this tags.