Revision 273 is a pre-publication revision. (Viewing current revision instead.)

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(). [php] 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; } [/php] In your theme, call the function within the loop: [php] get_the_content_with_formatting(); [/php]

Revisions

Revision Differences

October 4, 2012 @ 03:08:20Current Revision
Content
 Added: See this post: http://www.web- templates.nu/ 2008/08/31/get_ the_content-with-formatting/
 Added: Normally the <em>get_ the_content()</em> tag returns the content without formatting. I found out a solution to make<em>get_the_ content()</em> tag return the same content as <em>the_content()</em>.
 Added: [php]
 Added: function get_the_content_ with_formatting ($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
 Added: $content = get_the_content( $more_link_text, $stripteaser, $more_file);
 Added: $content = apply_filters( 'the_content', $content);
 Added: $content = str_replace(']]&gt;', ']]&amp;gt;', $content);
 Added: return $content;
Deleted: Added: }
 Added: [/php]
 Added: In your theme, call the function within the loop:
 Added: [php]
 Added: get_the_content_ with_formatting();
 Added: [/php]

Note: Spaces may be added to comparison text to allow better line wrapping.

Tags: ,

No comments yet.

Leave a Reply