en WordPress.com Forums › Support Show/Hide Category Descriptions Author Posts May 16, 2008 at 2:54 am #228933 stablegirlMember 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!! May 16, 2008 at 3:10 am #229125 ellaellaMember As we have no access to .php files here, I’ll assume your friend’s blog is self-hosted and not hosted by wordpress.com. If so, you need to be at http://wordpress.org/support A sticky at the head of the forum explains the differences between .com and .org. Love the avatar! May 16, 2008 at 3:45 am #229130 stablegirlMember Thanks, ellaella!! Sorry about that- I forgot there were two different forums. And thanks for the compliment on my girl– her name is Rhona. :) May 16, 2008 at 3:53 am #229131 ellaellaMember Give her an apple from my avatar. :) Happy blogging. June 10, 2008 at 3:53 am #229411 geetkunalMember Thanks a lot for your help mate. i really need this code. Cheers. Author Posts The topic ‘Show/Hide Category Descriptions’ is closed to new replies.