Hello
<?php if (is_category('19') || in_category('19')) { ?>
DO SOME STUFF
<?php } ?>
That should work! 🙂
I want no just one category that not show? how to do that? that I mean, I have 15 and 19 category, and I don’t want this category show up in front my page.
How to do that?
<?php if ( !(in_category(’29’)) ) { ?>
<?php } ?>
Should exclude category 29.
Interesting.
Is there anything like an “AND” condition?
I.e. if variable 1 AND variable 2 are true, then display content X
else if variable 3 AND variable 4 are true, then display content Y?
Thank you – it would be precious help!
Paul Weber
Paul, here is a solution:
<?php
if (is_category('xyz')) {
Do something;
}
elseif (category('xyz2')) {
Do something else ;
}
elseif (category('xyz3')) {
Do something else;
}
else {
Do something if none of the above are true;
}
?>
– is_category can be replaced with any other conditional tag, ex: is_single(‘some single post’) OR is_post(‘some post’)
Paul another option is
<?php
if ($1 == TRUE && $2 == TRUE) {
echo “something”;
} elseif ($3 == TRUE && $4 == TRUE) {
echo “something else”;
} else {
echo “something completely different”;
}
?>