If you need to get_the_contents and preform some work on the string before printing to screen you will notice the echo will output your theme template tags. This is not ideal but there is an easy solution.
<? $content = get_the_content(); echo $content; ?>
This will often produce output similar to:
[theme_column width="xxx"] etc...
You can solve this issue by looking at how WordPress the_content() function works found in post-template.php
/** * Display the post content. * * @since 0.71 * * @param string $more_link_text Optional. Content for when there is more text. * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. */ function the_content($more_link_text = null, $stripteaser = false) { $content = get_the_content($more_link_text, $stripteaser); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; }
Now you can use the contents of the_content() directly within your theme file you are modifying OR you can add a function to your theme functions.php file. Be sure to give your new addition a unique name, for example:
function get_content($more_link_text = null, $stripteaser = false) { $content = get_the_content($more_link_text, $stripteaser); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; }
If you have added the get_content(); function to your theme functions.php file; you may use get_content() within the post loop anywhere in your theme.
<? $content = get_content(); //do something with content echo $content; ?>
Problem Solved.