Hi I am trying to use ternary operators with WordPress condtionals, using the code below, but it’s giving me a PHP error, what am I doing wrong?
echo is_home() : '1' ? '0';
Hi I am trying to use ternary operators with WordPress condtionals, using the code below, but it’s giving me a PHP error, what am I doing wrong?
echo is_home() : '1' ? '0';
You must be logged in to post a comment.
Syntax is wrong you need to phrase it like so:
so change your code to :
In this particular case you could even shorten it to: