get_the_content() WITH formatting

See this post: http://www.web-templates.nu/2008/08/31/get_the_content-with-formatting/

Normally the get_the_content() tag returns the content without formatting. I found out a solution to makeget_the_content() tag return the same content as the_content().

function get_the_content_with_formatting ($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
	$content = get_the_content($more_link_text, $stripteaser, $more_file);
	$content = apply_filters('the_content', $content);
	$content = str_replace(']]>', ']]>', $content);
	return $content;
}

In your theme, call the function within the loop:

get_the_content_with_formatting();

Revisions

Tags: ,

No comments yet.

Leave a Reply