Advertisement
salmancreation

if else in wp php

Feb 14th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php if( is_page_template('right-sidebar.php') ) { // check for page template
  2.     $layout_classes = 'col-lg-7 col-md-12';
  3. } elseif( is_single() || is_page() ) { // it's not the page template. Is it at least a post or page?
  4.     $layout_classes = 'col-lg-8 col-lg-offset-2';
  5. } else { // I suspect you want a fallback condition, not sure what it is.
  6.     $layout_classes = '{something}';
  7. } ?>
  8.  
  9. <div class="col-lg-12">
  10.     <div class="row">
  11.         <div class="<?php echo $layout_classes; ?>">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement