Show/Hide Category Descriptions
-
Hi,
I’m designing a new theme for a friend’s blog, and I have it set up so that category descriptions are displayed at the top of each category page. I’m using this code:
<p><?php echo category_description(); ?></p>
And the style sheet formats the paragraph so it has a gray background and a border. It works great.
Here’s the problem: Not every category has a description, and when there’s not a description, the page displays an empty, ugly gray box.
Can someone help me with an IF statement that would check to see if there’s a category description, and if there is, display it in the gray box; if there’s not, don’t display anything?
I’m thinking it has something to do with checking to see if the strlen variable is 0, but I’m not familiar enough with PHP to get the syntax right.
Any help would be much appreciated!!
- The topic ‘Show/Hide Category Descriptions’ is closed to new replies.