Support » Plugin: Custom Field Template » hide if empty when using shortcodes?

  • Resolved aptharsia


    I use the shortcode format for the layout of my post data. Part of it looks like this:

    Sometimes the maps field is left empty but because I have a style applied to the li there is a border at the bottom, like this: <a href=””>link</a>, see the extra line under ‘References’?

    Is there a way to hide the entire line of
    when that field is left blank?

Viewing 1 replies (of 1 total)
  • If anyone else is curious…

    global $post;
    $bathrooms = get_post_meta($post->ID, 'bathrooms', true);
    if ( !empty($bathrooms) ) { echo '<li>Baths: [bathrooms]</li> ' ; }

    Of course, change the word bathrooms to whatever value you have, but it worked for me.

Viewing 1 replies (of 1 total)
  • The topic ‘hide if empty when using shortcodes?’ is closed to new replies.