if else short hand failed in PHP -
this question has answer here:
<input type="submit" value="<? get_the_category( $id )[0]->name == 'english' ? echo 'find' : echo 'encontrar'; ?>">
not sure problem here, have problem doing shorthand of if else condition.
please ensure can't use echo way since has no return type.
you can try either of these:
<?php echo (get_the_category( $id )[0]->name == 'english') ? 'find' : 'encontrar'; ?>
or
<? get_the_category( $id )[0]->name == 'english' ? print 'find' : print 'encontrar'; ?>
Comments
Post a Comment