Created
November 19, 2015 10:04
-
-
Save oliwa/b308883e91ec57fc2c1a to your computer and use it in GitHub Desktop.
Conditionals
This file contains hidden or 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
| <?php if(is_page('xy')) { ?> | |
| // do something on the xy page | |
| <?php } ?> | |
| <?php if(!is_page('xy')) { ?> | |
| // do something on every but the yx page | |
| <?php } ?> | |
| <?php if(is_page('xy') || is_page('xyz') ) { ?> | |
| // do something on the xy and xyz page | |
| <?php } ?> | |
| <?php if(!is_page(array('x','y','z'))) { ?> | |
| // do something on the pages x,y and z | |
| <?php } ?> | |
| <?php if(is_page('x')) { ?> | |
| // do something on the xy page | |
| <?php } else { ?> | |
| // do something else on all other pages | |
| <?php endif } ?> | |
| <?php if(is_page('x')) { ?> | |
| // do something on the x page | |
| <?php } elseif (is_page('y') { ?> | |
| // do something on the y page | |
| <?php } else { ?> | |
| // do something else on all other pages | |
| <?php endif } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment