Just put the name between the parentheses instead.
That’s actually the first thing i tried. So that line looked like
if ( in_category('permanent') ) {
and no luck. Do you know for a fact that works? See anything wrong with the way I’ve written it? That’s exactly what I want to do and it didn’t seem to be supported in the older version according to this Codex page. I was hoping for some more flexibility in WP 2.0
Hmm, that should have worked. I’m stumped, because that works for is_category();
. What’s the full PHP call you’re putting after the brace “{
“?
Thanks for the feedback. I tried to make the code inside the braces as simple as possible to test the in_category function so it is just an echo. This code does work.
<?php
if ( in_category(22) ) {
echo 'inside category 22';
}
?>
and this does not
<?php
if ( in_category('permanent') ) {
echo 'inside category permanent';
}
?>
I’ve double checked the spelling and case of the category name, there doesn’t seem to be a problem there.
According to the codex page you listed about in_category
, it looks like only the ID can be used. Would is_category
work for what you are attempting to do?
Thanks for your reply Jon,
It looks like is category is used to tell when a category page is being displayed. Since I am sorting posts not displaying a category page that doesn’t seem applicable. Good to know it’s out there but I’ll have to keep looking.
Codex reference for is_category