ploogo
8/16/2013 - 2:26 PM

Wordpress PHP for displaying nothing when nothing is entered in a meta box.

Wordpress PHP for displaying nothing when nothing is entered in a meta box.

<?php
                                                $my_meta = get_post_meta($post->ID, '_my_meta', TRUE);
                                                if( ! empty( $my_meta['video'] ) ) {
                                                                echo '<h3>';
                                                                echo $my_meta['slugline'];
                                                                echo '</h3>';
                                                                echo do_shortcode('[video width="100%" height="160px" vimeo="'. $my_meta['video'] .'"]');
                                                                echo '<a href="/enroll" class="action">Enroll Today »</a>';
                                                                echo the_post_thumbnail( 'program' );
                                                }else{
                                                                echo '<h3>';
                                                                echo $my_meta['slugline'];
                                                                echo '</h3>';
                                                                echo the_post_thumbnail( 'program' );
                                                                echo '<a href="/enroll" class="action">Enroll Today »</a>';
                                                }
                                                ?>