oliwa
11/19/2015 - 10:04 AM

Conditionals

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 } ?>