Skip to content

Instantly share code, notes, and snippets.

@oliwa
Created November 19, 2015 10:04
Show Gist options
  • Select an option

  • Save oliwa/b308883e91ec57fc2c1a to your computer and use it in GitHub Desktop.

Select an option

Save oliwa/b308883e91ec57fc2c1a to your computer and use it in GitHub Desktop.
Conditionals
<?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