Advertisement
alchymyth

conditional table output

Aug 27th, 2012
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2. $gender = get_post_meta($post->ID, "gender", true);
  3. $birth_year = get_post_meta($post->ID, "birth_year", true);
  4. $current_location = get_post_meta($post->ID, "current_location", true);
  5. $availability = get_post_meta($post->ID, "availability", true);
  6. if( $gender || $birth_year || $current_location || $availability ) : ?>
  7. <table border="1" id="personal">
  8. <caption STYLE="text-align:left"><h2>Personal Information</h2></caption>
  9. <tr>
  10. <th width="19%">Gender</th><th width="16.9%">Birth Year</th><th>Current Location</th><th>Availability</th>
  11. </tr>
  12. <tr>
  13. <td><?php if( $gender ): ?>
  14. <p><?php echo $gender; ?></p>
  15. <?php endif;?>
  16. </td>
  17. <td><?php if( $birth_year ): ?>
  18. <p><?php echo $birth_year; ?></p>
  19. <?php endif;?></td>
  20. <td><?php if( $current_location ): ?>
  21. <p><?php echo $current_location; ?></p>
  22. <?php endif;?></td>
  23. <td><?php if( $availability ): ?>
  24. <p><?php echo $availability; ?></p>
  25. <?php endif;?></td>
  26. </tr>
  27. </table>
  28. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement