Combining two conditions
-
Hi,
I’ve found myself with a WP challenge where I have to display something different depending on two categories and whether the user is logged in or not.
So there are 5 different permutations of delivering information. This is inside the loop on a custom page template.
If is in category “fruit” and user is logged in
do thisIf is in category “fruit” and user is logged out
do thisIf is in category “veg” and user is logged in
do thisIf is in category “veg” and user is logged out
do thiselseif (is in another category other that fruit or veg and irrespective of whether they’re logged in or not)
do thisFor categories I use:
<?php if (in_category('veg')) { ?>For user logged in I use
<?php if (is_user_logged_in() ) { ?>But I can’t combine the two.
The topic ‘Combining two conditions’ is closed to new replies.