Created
September 7, 2018 07:56
-
-
Save braddalton/86b0b235aef30b2d1c787b3f740c6fd1 to your computer and use it in GitHub Desktop.
Using if elseif else conditional statements in Genesis https://wpsites.net/php-code/if-else/
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( 'genesis_before_content_sidebar_wrap', 'if_elseif_else_code_test' ); | |
function if_elseif_else_code_test() { | |
if ( is_front_page() ) { | |
echo '<p style="color:blue;">This prints on your front page</p>'; | |
} elseif ( is_singular('post') ) { | |
echo '<p style="color:green;">This text prints on all single posts excluding your front page</p>'; | |
} else { | |
echo '<p style="color:red;">Print this on all pages if all other conditions return false</p>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment