Don't show the Excerpt if empty

Hi!

I have the Excerpt dynamic content on the post layout:

{{dc:post:excerpt fallback="No excerpt"}}

When the Excerpt post field is empty, it pulls in the beginning of the content. I’d like to prevent that from happening. I am trying to set a condition to hide the Except if the field is empty, but it keeps loading text from the content and it doesn’t hide.

How could I construct the condition to hide the Excerpt if the Excerpt field is empty?

Thank you!

Hello @Misho,

Thanks for writing in!

By default, the {{dc:post:excerpt fallback="No excerpt"}} dynamic content will display the auto excerpt if the manual excerpt is not set. Even if you are using a different theme and used the the_excerpt() function, this will still display the auto excerpt when the manual excerpt is not set. You will need to create your own custom PHP function that detects whether a manual excerpt is set or not. You can do that by utilizing the has_excerpt() function. perhaps these links might interest you:

Best Regards.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.