How to hide a section when having no content?
-
Hello, maybe someone can help me.
I’m using this code in my single.php:
get_template_part( ‘inc/related-videos’ );Is it possible to hide this code when no content is available?
This is my inc/related-videos code:
https://paste2.org/weBNh8NII tried check “echo_ald_crp()” to see if it wasn’t empty:
$var = echo_ald_crp();
if(!empty($var)) {But it didn’t work as I expected, take a look to these screenshots:
Before the code change:?https://prnt.sc/KsoW5PiBQ8tq
After the code change with content:?https://prnt.sc/BQ4MGEFQ_8zD
After the code change without content:?https://prnt.sc/wqMdDPUsv4szWhen having content, the code shouldn’t be hidden, only when is empty like in the last screenshot. Any idea how to fix the code to not hide when having content? ??
Thank you in advance!
- The topic ‘How to hide a section when having no content?’ is closed to new replies.