Hiding Div when get_post_meta is empty
-
I have this div, which works perfectly:
<div class="story_header"> <h3><?php echo get_post_meta($post->ID, 'story_header', true); ?></h3> </div>
I’m trying to do this instead, but it won’t work:
<?php $header = get_post_meta($postID->ID, 'story_header', true); if ( $header ) { ?> <div class="story_header"> <h3><?php echo get_post_meta($post->ID, 'story_header', true); ?></h3> </div> <?php } else {} ?>
What am I doing wrong here, and how can I make this function the way I want?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Hiding Div when get_post_meta is empty’ is closed to new replies.