Hide when content description is truly empty
-
Hi!
I have used this expression in the divi content visibility field to hide a header:get_the_content() !==”
That worked well but I found that if there’s a newline/tab/whitespace in the description and nothing else then “get_the_content” returns true.
So I tried with this expression:
preg_match(‘/^(?![\s\S])|(\s*[\s])$/g’, get_the_content()) == 0
But that doesn’t work. The header is displayed no matter whether there’s content or not.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Hide when content description is truly empty’ is closed to new replies.