Answer the question
In order to leave comments, you need to log in
How to forbid replacing the_excerpt with the_content in case the_excerpt is empty?
I need to do that on the post page, if "Excerpt" (the_excerpt()) is filled, then "excerpt was displayed".
If not, then it didn't show up.
Tried this option:
$my_excerpt = get_the_excerpt();
if ( $my_excerpt ){
echo $my_excerpt;
}
else {
echo 'Цитата не установлена.';
}
?>
Answer the question
In order to leave comments, you need to log in
Use has_excerpt(), this function checks if the current post has a short description
if( has_excerpt() ){
the_excerpt();
} else {
echo 'Цитата не установлена.';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question