This page redirects to an external site: https://developer.wordpress.org/reference/functions/the_content/
Languages: English • 日本語 (Add your language)
Displays the contents of the current post. This template tag must be within The_Loop.
If the quicktag <!--more--> is used in a post to designate the "cut-off" point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!--more--> quicktag point on non-single/non-permalink post pages. By design, the_content() tag includes a parameter for formatting the <!--more--> content and look, which creates a link to "continue reading" the full post.
<code style="color: #000000"><span style="color: #0000BB"><?php the_content</span><span style="color: #007700">( </span><span style="color: #0000BB">$more_link_text</span><span style="color: #007700">, </span><span style="color: #0000BB">$stripteaser </span><span style="color: #007700">); </span><span style="color: #0000BB">?></span></code>
How to pass parameters to tags with PHP function-style parameters
Displays the content of the post and uses "Read more..." for the more link text when the <!--more--> Quicktag is used.
<?php the_content('Read more...'); ?>
Similar to the above example, but thanks to the_title() tag and the display parameter, it can show "Continue reading ACTUAL POST TITLE" when the <!--more--> Quicktag is used.
<?php the_content("Continue reading " . get_the_title()); ?>
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.
<?php
global $more; // Declare global $more (before the loop).
$more = 0; // Set (inside the loop) to display content above the more tag.
the_content("More...");
?>
if you need to display all of the content:
<?php global $more; // Declare global $more (before the loop). $more = 1; // Set (inside the loop) to display all content, including text below more. the_content(); ?>
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.
<?php
if (is_sticky()) {
global $more; // Declare global $more (before the loop).
$more = 1; // Set (inside the loop) to display all content, including text below more.
the_content();
} else {
global $more;
$more = 0;
the_content('Read the rest of this entry »');
}
?>
You may use get_the_content() to return the content value instead of outputting it directly. Example:
<?php $content = get_the_content(); ?>
Please note! get_the_content will return the unfiltered content. If you want to achieve the same output that the_content() returns, use the following code:
<?php $content = apply_filters( 'the_content', get_the_content() ); $content = str_replace( ']]>', ']]>', $content ); ?>
Since: 0.71
the_content() is located in wp-includes/post-template.php.