Displays the post content.
Parameters
$more_link_text
stringoptional- Content for when there is more text.
Default:
null
$strip_teaser
booloptional- Strip teaser content before the more text.
Default:
false
Source
function the_content( $more_link_text = null, $strip_teaser = false ) {
$content = get_the_content( $more_link_text, $strip_teaser );
/**
* Filters the post content.
*
* @since 0.71
*
* @param string $content Content of the current post.
*/
$content = apply_filters( 'the_content', $content );
$content = str_replace( ']]>', ']]>', $content );
echo $content;
}
Hooks
- apply_filters( ‘the_content’,
string $content ) Filters the post content.
Changelog
Version | Description |
---|---|
0.71 | Introduced. |
Overriding Archive/Single Page Behavior
If
the_content()
isn’t working as you desire (displaying the entire story when you only want the content above the<!--more-->
Quicktag, for example) you can override the behavior with global $more.If you need to display all of the content:
Ignore the “More” on a Sticky Post
This will ignore the more tag in a sticky post–meaning it will display the full content even if there is a
<!--more-->
in the content, but for all other posts it will display a more link.Include Title in “More”
Show “Continue reading ACTUAL POST TITLE” when the
Quicktag is used.
If the content you want to display does not belong to the post declared globally you can use get_extended() which accepts the content as first parameter.
get_extended($content)
Reference:
https://codex.wordpress.org/Function_Reference/get_extended
Designating the “More” Text
Displays the content of the post and uses “Read more …” for the more link text when the
Quicktag is used.