I’m working on a theme and on the category page I’m displaying the category description inside a styled div container, however when there’s no description available for a certain category this div looks pretty darn ugly all empty, I came up with a rudimentary solution but I’m not sure is the proper way, seems to work though.
<?php if (category_description( $category ) == '') : ?> <div> <?php else : ?> <div class="cat-descr"> <?php endif; ?> <?php echo category_description( $category ); ?> </div>
any other idea to beautify the code? 🙂
- The topic ‘if category description do this, else… a better way?’ is closed to new replies.