if category description = empty …
-
<?php foreach (get_the_category() as $cat) { $parent = get_category($cat->category_parent); $parent_name = $parent->cat_name; $parent_description = $parent->description; echo '<div id="content_headline"><h1>'.$parent_name.'</h1></div>'; if (strlen($parent_description)>0) { echo '<div id="content_main">'.$parent_description.'</div>'; } } ?>I use this code to display the parent cat and it’s description.
The bit to check if there actually is a description does no work … I get the DIVs no matter what.
Any ideas?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘if category description = empty …’ is closed to new replies.