Append to Content

If you need to auto-append information to the end of your page/post content, there’s an easier way to do it than editing your theme.

add_filter( 'the_content', 'append_to_content' );
function append_to_content($content) {
	global $post;
	//if you want to restrict this to a specific post type
	if (get_post_type($post) == 'post') {
		$content .= '<p style="text-align:center;">***</p>';
	return $content;

Can be especially useful for auto-appending custom field information

Leave a Reply

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

%d bloggers like this: