A quick hand (PHP IF)
-
I’m trying to rid up a simple script in my category template that will first check to see if it’s a category page, then check the ID of the category and then parse in a description based on the ID of the category. For whatever reason, I got the first part right, but I can’t get the second part right. I can’t find any pages through google really detailing what I’m doing wrong so I figured I’d ask here.
<?php if (is_category()) : ?>
<div class="cat-desc"><?php if (single_cat_title() == "General") : ?>
(This is where the description goes for the General category)
<?php endif; ?></div>
<?php endif; ?>Where am I going wrong? This “works” but all it does is, instead of displaying the description, it displays the name for the categories.
The topic ‘A quick hand (PHP IF)’ is closed to new replies.