Inspiration For Creative Minds
Home » Labs » How to insert auto content after post on WordPress  

Filed under Labs

If you want to show a default content like ‘If you like this then please share it!’ on bottom of every post then below code will be really useful. This short snippet will allow you to auto insert content at the end of a post. Open your functions.php and add below code to it.

 
<?php 
	function end_post($content) {
	if(!is_feed() && !is_home()) {
	$content.= "<h2>Enjoy this?</h2>";
	$content.= "<p>Tweet about this post: etc...</p>";
	}
	return $content;
	}
	add_filter ('the_content', 'end_post');
?>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook
Labs

Posts you may like: