Title: hide if empty when using shortcodes?
Last modified: August 21, 2016

---

# hide if empty when using shortcodes?

 *  Resolved [aptharsia](https://wordpress.org/support/users/aptharsia/)
 * (@aptharsia)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/hide-if-empty-when-using-shortcodes/)
 * I use the shortcode format for the layout of my post data. Part of it looks like
   this:
    `<li>[maps]</li> <li>[references]</li>‘
 * 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=”[http://www.oldhousedreams.com/2010/06/10/1639-cape-cod-sandwich-ma”>link</a&gt](http://www.oldhousedreams.com/2010/06/10/1639-cape-cod-sandwich-ma”>link</a&gt);,
   see the extra line under ‘References’?
 * Is there a way to hide the entire line of
    `<li>[maps]</li>` when that field 
   is left blank?
 * [http://wordpress.org/extend/plugins/custom-field-template/](http://wordpress.org/extend/plugins/custom-field-template/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [aptharsia](https://wordpress.org/support/users/aptharsia/)
 * (@aptharsia)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/hide-if-empty-when-using-shortcodes/#post-3737045)
 * If anyone else is curious…
 *     ```
       <?php
       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.

 * ![](https://ps.w.org/custom-field-template/assets/icon-256x256.png?rev=1966286)
 * [Custom Field Template](https://wordpress.org/plugins/custom-field-template/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-field-template/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-template/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-template/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-template/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-template/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [aptharsia](https://wordpress.org/support/users/aptharsia/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/hide-if-empty-when-using-shortcodes/#post-3737045)
 * Status: resolved