Created
January 15, 2018 04:20
-
-
Save braddalton/b23ace7415383713dbb1b8ceadf0a83f to your computer and use it in GitHub Desktop.
Ternary Operator in PHP https://wpsites.net/php-code/code-php-using-ternary-operator-replacing-if-else-statement/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'loop_start', 'ternary_operator_method_three' ); | |
function ternary_operator_method_three() { | |
$output = is_front_page() ? 'Only on the front page' : 'Otherwise different on all others'; | |
echo $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment