How do I show the excerpt in the same post is page?
Example:
<?php
if ( the_excerpt() != '' ) {
echo $my_excerpt;
}
?>
But this does not work!
How do I show the excerpt in the same post is page?
Example:
<?php
if ( the_excerpt() != '' ) {
echo $my_excerpt;
}
?>
But this does not work!
the_excerpt()将回显摘录,而get_the_excerpt()将返回它。所以尝试这样的事情:
<?php
$my_excerpt = get_the_excerpt();
if ( $my_excerpt != '' ) {
echo $my_excerpt;
}
?>