how do i hide my html table if there are no value
-
Hello wordpress community.
In my single post php, I added a table…
<table border="1" id="personal"> <caption STYLE="text-align:left"><h2>Personal Information</h2></caption> <tr> <th width="19%">Gender</th><th width="16.9%">Birth Year</th><th>Current Location</th><th>Availability</th> </tr> <tr> <td><?php $key="gender"; if(get_post_meta($post->ID, $key, true)): ?> <p><?php echo get_post_meta($post->ID, $key, true); ?></p> <?php endif;?> </td> <td><?php $key="birth_year"; if(get_post_meta($post->ID, $key, true)): ?> <p><?php echo get_post_meta($post->ID, $key, true); ?></p> <?php endif;?></td> <td><?php $key="current_location"; if(get_post_meta($post->ID, $key, true)): ?> <p><?php echo get_post_meta($post->ID, $key, true); ?></p> <?php endif;?></td> <td><?php $key="availability"; if(get_post_meta($post->ID, $key, true)): ?> <p><?php echo get_post_meta($post->ID, $key, true); ?></p> <?php endif;?></td> </tr> </table>
[please use the code button instead of blockquote to mark any code – https://codex.www.ads-software.com/Forum_Welcome#Posting_Code ]
how do i hide this table using php if there are no values in the custom fields?
THANK YOU AHEAD OF TIME!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘how do i hide my html table if there are no value’ is closed to new replies.